/*! shop 2019-04-16 */
define("/common/js/app", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //注册组件 , 帖子列表
    var app = function(params) {
        app.wxLoad = null;
        //app.wx = require("jweixin");
        app.params = {
            versions: "6.7",
            userVersions: "2.4",
            urlChangeFromComponent: 1,
            debug: true,
            urlCache: {},
            loadPage: 0,
            plugUrl: "/",
            bindPhone: false,
            apiDomain: "http://tenement.com/",
            //不带"/"
            //domain: 'http://www.codecamp.com', 
            loginUrl: "https://login.bestsmartbee.com/"
        };
        for (var i in params) {
            app.params[i] = params[i];
        }
        app.pageData = {};
        var fun = {
            setWxShareData: function() {
                if (!app.isWeiXin()) {
                    return;
                }
                if (app.params.DefShareData) {
                    app.wxDefShare(app.params.DefShareData);
                } else {}
            },
            isWeiXin: function() {
                //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息，这个属性可以用来判断浏览器类型
                var ua = window.navigator.userAgent.toLowerCase();
                //通过正则表达式匹配ua中是否含有MicroMessenger字符串
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return true;
                } else {
                    return false;
                }
            },
            isAlipay: function() {
                //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息，这个属性可以用来判断浏览器类型
                var ua = window.navigator.userAgent.toLowerCase();
                if (ua.match(/Alipay/i) == "alipay") {
                    return true;
                } else {
                    return false;
                }
            },
            //实例化VueApp
            init: function() {
                //创建和挂载根实例
                var VueApp = new Vue({
                    router: router,
                    watch: {
                        // 如果路由有变化，会再次执行该方法
                        $route: "fetchData"
                    },
                    mounted: function() {
                        this.fetchData();
                        app.setWxShareData();
                    },
                    methods: {
                        fetchData: function() {
                            //  console.log(this.$route);
                            var name = this.$route.name;
                            var options = app.findOptionsByName(name);
                            if (!options.name) {
                                return;
                            }
                            var hash = window.location.hash;
                            if (hash && hash.indexOf("component_") > -1) {
                                return false;
                            }
                            var id = "#page" + app.ucfirst(name);
                            var wrap = "#router-view-tmp";
                            //页面是要缓存的
                            if (options.page == "cache") {
                                wrap = "#router-view-cache";
                            } else {
                                wrap = "#router-view-tmp";
                                // 如果是组件路由发生变化，不清缓存
                                // if(app.params.urlChangeFromComponent==1){
                                //     $(wrap).html("");
                                // }
                                // console.log(app.params.preRoute);
                                // if ($(id).length > 0  && $(id).attr('url') !=window.location.href) {
                                //    var url = $(id).attr('url');
                                //    $(id).remove();
                                // }
                                if ($(id).length > 0) {
                                    $(id).remove();
                                }
                            }
                            if ($(id).length > 0 && $(id).attr("url") != window.location.href) {
                                var url = $(id).attr("url");
                                $(id).remove();
                            }
                            app.params.preRoute = name;
                            $(".page").addClass("cached").removeClass("pageShow");
                            var loadingPage = '<div class="loadingPage" style="text-align: center;margin-top: 100px;">正在为您努力加载页面。。。。</div>';
                            $("body").append(loadingPage);
                            if (options.title) {
                                app.setTitle(options.title);
                            }
                            if ($(id).length > 0) {
                                $(id).removeClass("cached").addClass("pageShow");
                                $(".loadingPage").remove();
                                var pageVm = app.getVm(name);
                                if (pageVm) {
                                    typeof pageVm.pageShow === "function" ? pageVm.pageShow() : "";
                                }
                                if (typeof app.pageShow == "function") {
                                    app.pageShow({
                                        name: name,
                                        vm: pageVm
                                    });
                                }
                            } else {
                                app.routePage(name, wrap);
                            }
                        }
                    }
                }).$mount("#app");
                if (typeof app.afterInit == "function") {
                    app.afterInit();
                }
            },
            // 加载组件
            component: function(name, params) {
                // app.params.urlChangeFromComponent=1;
                require.async("/component/template_js/" + name, function(html) {
                    // console.log(html);
                    var id = "component_" + name;
                    app.popup(id, html, "body");
                    window.location.href = "#" + id;
                    $(".popupBg").remove();
                    require.async("/component/" + name, function(component) {
                        component.vue(params);
                        // app.params.urlChangeFromComponent=0;
                        $("#" + id).addClass("page").addClass("popup_page");
                    });
                });
            },
            wxShare: function(params, callblack) {
                var data = {
                    title: params["title"],
                    // 分享标题
                    link: params["url"] ? params["url"] : window.location.href,
                    // 分享链接
                    imgUrl: params["imgUrl"],
                    // 分享图标
                    desc: params["desc"],
                    success: function() {},
                    cancel: function() {}
                };
                app.wx(function(wx) {
                    // console.log(data);
                    wx.onMenuShareTimeline(data);
                    wx.onMenuShareAppMessage(data);
                    callblack ? callblack() : "";
                });
            },
            wx: function(callblack) {
                require.async("jweixin", function(wx) {
                    app.wx = wx;
                    typeof callblack == "function" ? callblack(wx) : "";
                });
            },
            //传入一个name ， 会加载对应的html ,和js , 生成id : page-id
            routePage: function(name, wrap, ajax) {
                if (!name) {
                    return false;
                }
                // console.log(name);
                // component
                // 默认的
                if (!wrap) {
                    wrap = "#router-view-tmp";
                }
                var id = "page" + app.ucfirst(name);
                console.log("template_js/" + name);
                require.async("template_js/" + name, function(content) {
                    if (typeof content == "string") {
                        content = content.replace(/<img/g, "<img onerror=\"javascript:this.src='https://img.bestsmartbee.com/1536138807127'\" ");
                    }
                    var url = window.location.href;
                    if (ajax == 1) {
                        content = $("<div>" + content + "</div>").find(".ajaxPageContent").html();
                        content = "<div url=" + url + " id='" + id + "'>" + content + "</div>";
                    } else {
                        content = "<div url=" + url + " class='page pageShow' id='" + id + "'>" + content + "</div>";
                    }
                    var wrapContent = $(content);
                    $(wrapContent).hide();
                    $(wrapContent).appendTo(wrap);
                    var pageId = "#" + id;
                    var options = {
                        name: name
                    };
                    // console.log("js/" + name);
                    require.async("js/" + name, function(controller) {
                        // console.log(options);
                        // console.log(options,controller.pageShow);
                        controller.vue(options);
                        var vm = controller.vm;
                        $(pageId).show();
                        $(".loadingPage").remove();
                        if ($(pageId).find(".page-content").length > 0) {
                            app.scrollPreventDefault($(pageId).find(".page-content").eq(0));
                        }
                        if (typeof vm.pageShow == "function") {
                            vm.pageShow(options);
                        }
                        if (typeof app.pageShow == "function") {
                            options.vm = controller.vm;
                            app.pageShow(options);
                        }
                    });
                });
            },
            //禁用滚动
            scrollPreventDefault: function(pageContent) {
                function pageContentTouchstart() {
                    var el = this;
                    var top = el.scrollTop, totalScroll = el.scrollHeight, currentScroll = top + el.offsetHeight;
                    if (top === 0) {
                        $(el).attr("_isScroller", 1);
                        el.scrollTop = 2;
                    } else if (currentScroll === totalScroll) {
                        $(el).attr("_isScroller", 1);
                        el.scrollTop = top - 2;
                    }
                }
                function pageContentTouchmove() {
                    var el = this;
                    var top = el.scrollTop, totalScroll = el.scrollHeight, currentScroll = top + el.offsetHeight;
                    if (top === 0) {
                        $(el).attr("_isScroller", 0);
                    } else if (currentScroll === totalScroll) {
                        $(el).attr("_isScroller", 0);
                    }
                }
                function preventDefault(evt) {
                    var _isScroller = $(".pageShow .page-content").attr("_isScroller");
                    //pageContent 滚动到底部或顶部时禁用滚动
                    if (_isScroller == "0") {
                        evt.preventDefault();
                    }
                }
                //判断pageContent 滚动的位置， 如果滚动到顶部或底部， 禁用滚动
                $(pageContent).unbind("touchstart", pageContentTouchstart).bind("touchstart", pageContentTouchstart);
                $(pageContent).unbind("touchmove", pageContentTouchmove).bind("touchstart", pageContentTouchmove);
                //当pageContent顶部或底部， body是不能能滚动
                $("body").unbind("touchmove", preventDefault).bind("touchmove", preventDefault);
                //评价用户作品添加滚动效果
                // $(".add-comment-info").on("touchmove", function(event) {
                //     event.stopPropagation();
                // });
                // $(".add-comment-info").on("touchend", function(event) {
                //     event.stopPropagation();
                //     document.body.scrollTop = 0;
                // });
                //头部不能能滚动
                $("#header").unbind("touchmove").bind("touchmove", function(evt) {
                    evt.preventDefault();
                });
                //底部不能能滚动
                $(".bottom-fixed").unbind("touchmove").bind("touchmove", function(evt) {
                    evt.preventDefault();
                });
            },
            //找到这路由的配置
            findOptionsByName: function(name) {
                var options = router.options.routes;
                for (var item in options) {
                    if (name == options[item]["name"]) {
                        return options[item];
                    }
                }
                return {};
            },
            confirm: function(params) {
                //  $(".confirm").remove();
                // $("body").find(".popupBg").remove();
                var confirmText = params.confirmText ? params.confirmText : "确定";
                var cancelText = params.cancelText ? params.cancelText : "取消";
                var html = '<div class="confirm" id="appConfirm">';
                html += '<div class="confirm-text">' + params.text + "</div>";
                html += '<ul class="confirm-options">';
                html += '<li class="bl">' + cancelText + "</li> <li>" + confirmText + "</li>";
                html += "</ul>";
                html += "</div>";
                var yes = params.yes;
                $("body").append(html);
                // if ($("body").find(".popupBg").length > 0) {
                //     $("body").find(".popupBg").remove();
                // }
                $('<div class="popupBg"></div>').insertBefore("#appConfirm");
                $(".popupBg").unbind("click").bind("click", function() {
                    app.confirmNo();
                });
                $("#appConfirm .confirm-options li").eq(0).click(function() {
                    app.confirmNo(params.no);
                });
                var left = $(".confirm").width() / 2;
                $(".confirm").css("margin-left", "-" + left + "px");
                $("#appConfirm .confirm-options li").eq(1).click(function() {
                    app.confirmNo();
                    yes ? yes() : "";
                });
            },
            confirmNo: function() {
                $(".confirm").remove();
                $("body").find(".popupBg").remove();
            },
            //操作选项
            handle: function(params) {
                var optionsHtml = "";
                for (var i in params) {
                    optionsHtml += '<div class="handle-options-one">' + params[i]["text"] + "</div>";
                }
                var html = '<div class="handle-options">';
                html += '<div class="handle-options-group">';
                html += optionsHtml;
                html += " </div>";
                html += '<div class="handle-options-last colse">取消</div>';
                html += " </div>";
                app.popup("handle", html);
                $(".handle-options-one").click(function() {
                    var callblack = params[$(this).index()]["methods"];
                    callblack ? callblack() : "";
                    $("#handle").prev().remove();
                    $("#handle").remove();
                });
            },
            colseHandle: function() {
                $("body").find(".popupBg").remove();
                $("#handle").remove();
            },
            //popup 弹出方式
            popup: function(id, content, container) {
                if ($("body").find("#" + id).length > 0) {
                    $("body").find("#" + id).remove();
                }
                var html = '<div class="popup" id="' + id + '">' + content + "</div>";
                if (container) {
                    $(container).append(html);
                } else {
                    $(".pageShow").append(html);
                }
                app.show_popup("#" + id);
            },
            //
            show_popup: function(popupId) {
                if ($("body").find(".popupBg").length > 0) {
                    $("body").find(".popupBg").remove();
                }
                $('<div class="popupBg"></div>').insertBefore(popupId);
                $(popupId).addClass("popup-modal-in");
                $(".popupBg").bind("click", function() {
                    app.hide_popup();
                });
                $(popupId).find(".colse").bind("click", function() {
                    app.hide_popup();
                });
            },
            hide_popup: function() {
                $(".popup").removeClass("popup-modal-in");
                $("body").find(".popupBg").remove();
            },
            //图片加载延迟
            picLazyLoad: function(imgs, fn) {
                require.async("plug/picLazyLoad", function(picLazyLoad) {
                    picLazyLoad.watch(imgs, fn);
                });
            },
            //copy  //  data-clipboard-text="Just because you can doesn't mean you should — clipboard.js"
            copy: function(id, callblack) {
                require.async("/plug/clipboard.min", function(clipboard) {
                    var clipboard = new ClipboardJS(id);
                    clipboard.on("success", function(e) {
                        e.clearSelection();
                        callblack ? callblack("success") : "";
                    });
                    clipboard.on("error", function(e) {
                        callblack ? callblack("error") : "";
                    });
                });
            },
            //首字母大写
            ucfirst: function(str) {
                if (typeof str !== "string") {
                    return "";
                }
                var strs = str.split("/");
                var res = "";
                for (var i in strs) {
                    str = strs[i];
                    //var str = str.toLowerCase();
                    str = str.replace(/\b\w+\b/g, function(word) {
                        return word.substring(0, 1).toUpperCase() + word.substring(1);
                    });
                    res += str;
                }
                return res;
            },
            setTitle: function(title) {
                $("#app-title").text(title);
                $("title").html(title);
            },
            showLoad: function() {
                //$("body").append("<div class='dialog loading'></div>");
                var html = '<div class="loader loader--style1" title="0">';
                html += '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"';
                html += ' width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">';
                html += '<path opacity="0.2" fill="#000" d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946';
                html += "  s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634";
                html += ' c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"/>';
                html += '<path fill="#000" d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0';
                html += '   C22.32,8.481,24.301,9.057,26.013,10.047z">';
                html += ' <animateTransform attributeType="xml"';
                html += '  attributeName="transform"';
                html += '  type="rotate"';
                html += ' from="0 20 20"';
                html += ' to="360 20 20"';
                html += ' dur="0.5s"';
                html += ' repeatCount="indefinite"/>';
                html += " </path>";
                html += "</svg>";
                html += "</div>";
                if ($("body").find(".loader--style1").length === 0) {
                    $("body").append(html);
                }
                $(".loader--style1").show();
            },
            hideLoad: function() {
                //$(".loading").remove();
                $(".loader--style1").hide();
            },
            //检查TOKEN 是否过期
            checkToken: function(callblack) {
                app.get("apiv2/user/checkToken", function(res) {
                    if (res.code != 200) {
                        app.delUserInfo();
                        app.auth();
                    } else {
                        callblack ? callblack() : "";
                    }
                });
            },
            login: function(callblack, fields) {
                var backUrl = window.location.href;
                var box_login_code = "";
                var Request = app.GetRequest(backUrl);
                var UserInfo = app.getUserInfo();
                // console.log("UserInfo:",UserInfo);
                if (UserInfo && UserInfo.user_id) {
                    app.checkToken(function() {
                        typeof callblack == "function" ? callblack(UserInfo) : "";
                    });
                } else if (Request && Request.token) {
                    var userInfoUrl = app.params.loginUrl + "index/getUserInfoByToken/?token=" + Request.token;
                    app.showLoad();
                    $.ajax({
                        url: userInfoUrl,
                        //可以不是本地域名 
                        type: "get",
                        data: {
                            fields: fields ? fields : "user_id,store_id,phone,nickname,phone,avatarUrl"
                        },
                        dataType: "jsonp",
                        //jsonp格式访问
                        success: function(data) {
                            if (data.code > 0) {
                                app.alert(data.msg);
                                app.relogin();
                            } else {
                                app.setUserInfo(data.userInfo);
                                app.hideLoad();
                                typeof callblack == "function" ? callblack(data.userInfo) : "";
                                if (app.params.bindPhone && !data.userInfo.phone) {
                                    app.bindPhone();
                                }
                            }
                        },
                        error: function() {
                            app.relogin();
                        }
                    });
                } else {
                    // var appId = app.getAppId();
                    // https://login.bestsmartbee.com/index/synclogin?inviteId=0&backUrl=http%3A%2F%2Ftenement.com%2Fadmin%2Fhome%2Findex
                    // console.log(loginUrl);
                    app.auth();
                }
            },
            relogin: function(text) {
                app.confirm({
                    text: text ? text : "授权登录发现异常，是否重新登录？",
                    yes: function() {
                        app.auth();
                    }
                });
            },
            auth: function() {
                var backUrl = window.location.href;
                var search = app.GetRequest(window.location.search);
                var store_id = search.store_id ? search.store_id : 0;
                var loginUrl;
                if (app.isWeiXin()) {
                    loginUrl = app.params.loginUrl + "index/getopenid/?store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                } else if (app.isAlipay()) {
                    loginUrl = app.params.loginUrl + "index/loginH5ByAlipay/?act=getUserId&store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                } else {
                    loginUrl = app.params.loginUrl + "index/synclogin/?store_id=" + store_id + "&backUrl=" + window.escape(backUrl);
                }
                // alert(loginUrl);
                window.location.href = loginUrl;
            },
            getStoreId: function() {
                var search = app.GetRequest(window.location.search);
                var store_id = search.store_id ? search.store_id : 0;
                return store_id;
            },
            getStore: function(callback) {
                var store_id = app.getStoreId();
                app.get("api/user/getStore", {
                    store_id: store_id
                }, function(res) {
                    callback ? callback(res.data) : "";
                });
            },
            getAppId: function() {
                var Request = app.GetRequest(window.location.href);
                if (Request.appId) {
                    return Request.appId;
                } else {
                    return "";
                }
            },
            wxJs: function(callblack) {
                if (app.wxLoad) {
                    typeof callblack == "function" ? callblack(app.wx) : "";
                    return;
                }
                app.get("api/wechat_tool/wxJs", function(signPackage) {
                    app.wx(function(wx) {
                        app.wxLoad = 1;
                        wx.config({
                            debug: false,
                            appId: signPackage.appId,
                            timestamp: signPackage.timestamp,
                            nonceStr: signPackage.nonceStr,
                            signature: signPackage.signature,
                            jsApiList: [ "onMenuShareTimeline", "onMenuShareAppMessage", "addCard", "chooseCard", "openCard", "chooseWXPay", "previewImage", "openLocation", "getLocation", "openAddress" ]
                        });
                        wx.ready(function() {
                            //alert(callblack);
                            typeof callblack == "function" ? callblack(wx) : "";
                        });
                        wx.error(function(res) {
                            //alert(callblack);
                            app.wxLoad = 0;
                            app.saveLog(res);
                            app.alert(res.errMsg);
                        });
                    });
                });
            },
            GetRequest: function(url) {
                var theRequest = new Object();
                if (url.indexOf("?") != -1) {
                    var str = url.split("?");
                    str = str[1];
                    var strs = str.split("&");
                    for (var i = 0; i < strs.length; i++) {
                        var v = strs[i].split("=")[1];
                        theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                    }
                }
                return theRequest;
            },
            alert: function(msg, callblack) {
                //alert("<div class='dialog'>"+msg+"</div>");
                if (typeof msg != "string") {
                    msg = JSON.stringify(msg);
                }
                $("body").append("<div class='dialog'>" + msg + "</div>");
                var width = $(".dialog").width() / 2;
                var h = $(".dialog").height() / 2;
                $(".dialog").css({
                    "margin-left": "-" + width + "px",
                    "margin-top": "-" + h + "px"
                });
                setTimeout(function() {
                    $(".dialog").remove();
                    typeof callblack == "function" ? callblack() : "";
                }, 1e3);
            },
            //版本号
            getVersions: function() {
                return app.params.versions;
            },
            //用户信息
            getUserInfo: function(type) {
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                var UserInfo = app.cache(userVersions).get("UserInfo");
                if (UserInfo && UserInfo.token) {
                    //callblack ? callblack(UserInfo) : "";
                    // UserInfo.user_id = 36;
                    // UserInfo.token='cca001ac8014eb17284d9545335abe12';
                    return UserInfo;
                }
                return {};
            },
            setUserInfo: function(userInfo) {
                // var userVersions = app.params.userVersions;
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                if (userInfo && userInfo.user_id && userInfo.token) {
                    var search = app.GetRequest(window.location.search);
                    delete search.token;
                    $.extend(userInfo, search);
                    var UserInfo = app.cache(userVersions).set("UserInfo", userInfo);
                }
            },
            delUserInfo: function(userInfo) {
                // var userVersions = app.params.userVersions;
                var store_id = app.getStoreId();
                var userVersions = app.params.userVersions + store_id;
                app.cache(userVersions).rm("UserInfo");
            },
            get: function(url, params, callblack) {
                app.showLoad();
                // console.log(params);
                var args = typeof params == "object" ? params : {};
                callblack = $.isFunction(params) ? params : callblack;
                var UserInfo = app.getUserInfo();
                if (UserInfo && UserInfo.token) {
                    args.token = UserInfo.token;
                }
                app.ajax({
                    type: "GET",
                    dataType: "json",
                    data: args,
                    success: function(res) {
                        // console.log(res);
                        callblack(res);
                    },
                    url: app.params.apiDomain + url
                });
            },
            post: function(url, params, callblack) {
                app.showLoad();
                // console.log(params);
                var args = typeof params == "object" ? params : {};
                callblack = $.isFunction(params) ? params : callblack;
                app.ajax({
                    type: "POST",
                    dataType: "json",
                    data: args,
                    success: function(res) {
                        callblack(res);
                    },
                    url: app.params.apiDomain + url
                });
            },
            loadCss: function(url) {
                url = app.params.plugUrl + url;
                var css_id = app.base64_encode(url);
                if (!app.params.urlCache[css_id]) {
                    app.params.urlCache[css_id] = css_id;
                    $("head").append('<link href="' + url + '" id="css_id_' + css_id + '" rel="stylesheet" type="text/css" />');
                }
            },
            //无限加载
            pager: function(id, callblack) {
                //$(window).unbind('scroll');
                function pagerContent() {
                    var bot = 100;
                    //bot是底部距离的高度
                    var nDivHight = $(this).height();
                    var nScrollHight = $(this)[0].scrollHeight;
                    var nScrollTop = $(this)[0].scrollTop;
                    if (nScrollTop + nDivHight + bot >= nScrollHight && app.params.loadPage == "0") {
                        $.isFunction(callblack) ? callblack() : "";
                    }
                }
                // console.log(id);
                $(id).find(".page-content").unbind("scroll", pagerContent);
                $(id).find(".page-content").scroll(pagerContent);
            },
            picker: function(id, params) {
                app.loadCss("plug/weui2/css/picker.css");
                // console.log(app.params.plugUrl +"plug/weui2/js/zepto.weui.min.js");
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    $(id).picker(params);
                });
            },
            datetimePickerWap: function(id, params) {
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    $(id).datetimePicker(params);
                });
            },
            cityPicker: function(id, params) {
                app.loadCss("plug/weui2/css/picker.css");
                app.getScript("plug/weui2/js/zepto.weui.min.js", function() {
                    app.getScript("plug/weui2/js/picker.city.js", function() {
                        $(id).cityPicker(params);
                    });
                });
            },
            upload: function(obj, callblack) {
                app.loadCss("plug/photo/photo.css");
                require.async(app.params.plugUrl + "plug/photo/photo.js", function(photo) {
                    photo.initUpload($(obj));
                    callblack ? callblack() : "";
                });
            },
            MultipleUpload: function(obj, callblack) {
                app.loadCss("plug/photo/photo.css");
                require.async(app.params.plugUrl + "plug/photo/photo.js", function(photo) {
                    photo.initMultipleUpload($(obj));
                    callblack ? callblack() : "";
                });
            },
            //时间插件
            datetimepicker: function(_this) {
                app.loadCss("plug/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css");
                app.loadCss("plug/bootstrap-datetimepicker/css/datetimepicker.css");
                app.getScript("plug/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js", function() {
                    app.getScript("plug/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js", function() {
                        $(_this).datetimepicker({
                            language: "zh-CN",
                            autoclose: 1,
                            minView: $(_this).attr("data-minview") ? $(_this).attr("data-minview") : 2
                        });
                    });
                });
            },
            lCalendar: function(id) {
                app.loadCss("plug/lCalendar.css");
                app.getScript("plug/lCalendar.min.js", function() {
                    var calendar = new lCalendar();
                    // alert($("#"+id).attr("type"));
                    calendar.init({
                        trigger: "#" + id,
                        type: $("#" + id).attr("data-type") ? $("#" + id).attr("data-type") : "date"
                    });
                });
            },
            _getScript: function(url, callback) {
                var head = document.getElementsByTagName("head")[0], js = document.createElement("script");
                js.setAttribute("type", "text/javascript");
                js.setAttribute("src", url);
                head.appendChild(js);
                //执行回调
                var callbackFn = function() {
                    if (typeof callback === "function") {
                        callback();
                    }
                };
                if (document.all) {
                    //IE
                    js.onreadystatechange = function() {
                        if (js.readyState == "loaded" || js.readyState == "complete") {
                            callbackFn();
                        }
                    };
                } else {
                    js.onload = function() {
                        callbackFn();
                    };
                }
            },
            //加载js
            getScript: function(url, callblack, versions) {
                url = app.params.plugUrl + url;
                app._getScript(url, function() {
                    callblack ? callblack() : "";
                });
            },
            ajax: function(params) {
                var userInfo = app.getUserInfo();
                var userInfoSearch = {};
                var search = app.GetRequest(window.location.search);
                delete search.token;
                if (userInfo) {
                    userInfoSearch = {
                        store_id: userInfo.store_id,
                        token: userInfo.token
                    };
                    if (userInfo.appid) {
                        userInfoSearch.appid = userInfo.appid;
                    }
                    if (userInfo.appid) {
                        userInfoSearch.openid = userInfo.openid;
                    }
                }
                // console.log(userInfoSearch);
                // return;
                $.extend(userInfoSearch, search);
                params = params ? params : {};
                if ($.isArray(params["data"])) {
                    for (var i in params["data"]) {
                        // userInfoSearch.push({
                        //       name:i,
                        //       value:params["data"][i]
                        //   });
                        userInfoSearch[params["data"][i]["name"]] = params["data"][i]["value"];
                    }
                    params["data"] = userInfoSearch;
                } else {
                    $.extend(userInfoSearch, params["data"]);
                    params["data"] = userInfoSearch;
                }
                console.log(userInfoSearch);
                var ajaxTimeoutTest = $.ajax({
                    url: params["url"],
                    type: params["type"],
                    dataType: params["dataType"],
                    data: params["data"],
                    cache: false,
                    timeout: 1e4,
                    beforeSend: function() {
                        app.showLoad();
                    },
                    success: function(result) {
                        var success = params["success"];
                        typeof success == "function" ? success(result) : "";
                    },
                    complete: function(msg, status) {
                        // console.log(msg.response);
                        app.hideLoad();
                        if (status == "timeout") {
                            //超时,status还有success,error等值的情况                       　　　　　
                            ajaxTimeoutTest.abort();
                            app.alert("由于网络原因，请求超时，请刷新网页试试");
                            app.saveLog("由于网络原因，请求超时，请刷新网页试试");
                        }
                        if (params["cache"]) {
                            var key = app.base64_encode(params["url"]);
                            var result = msg.response;
                            app.params.urlCache[key] = result;
                            app.cache().set(key, result);
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        app.saveLog(errorThrown);
                        console.log(errorThrown);
                    }
                });
            },
            //保存错误日志
            saveLog: function(msg) {
                console.log(msg);
            },
            //轮播图
            swiper: function(id) {
                app.loadCss("plug/Swiper-4.4.2/css/swiper.min.css");
                app.getScript("plug/Swiper-4.4.2/js/swiper.min.js", function() {
                    var swiper = new window.Swiper("#" + id, {
                        pagination: "#" + id + " .swiper-pagination",
                        //nextButton: '#swiper_<{$data.name}> .swiper-button-next',
                        //prevButton: '#swiper_<{$data.name}> .swiper-button-prev',
                        loop: true,
                        spaceBetween: 30,
                        centeredSlides: true,
                        autoplay: 5e3
                    });
                }, false);
            },
            //页面切换
            swiperPage: function(id, callblack) {
                //  app.loadCss("plug/Swiper-3.3.1/swiper.css");
                app.getScript("plug/Swiper-3.3.1/swiper-3.4.1.jquery.min.js", function() {
                    //绑定滚动事件,记住滚动位置
                    // var swiperH=$(id).attr("swiperH");
                    // var swiperT=$(id).attr("swiperT");
                    var pageContent = $(id).parents(".page-content");
                    var swiperWrap = $(id + "-container");
                    $(swiperWrap).find(".swiperTap").find(".active").addClass("scrollActive");
                    $(pageContent).scroll(function(event) {
                        var swiperIndex = $(swiperWrap).find(".swiperTap").find(".scrollActive");
                        var scrollTop = $(this).scrollTop();
                        var scroll = $(swiperIndex).attr("scroll");
                        if (scroll != "0") {
                            $(swiperIndex).attr("scrollTop", scrollTop);
                        }
                    });
                    var swiper = new window.Swiper(id, {
                        pareanContainer: id + "-container",
                        //autoHeight:true,
                        onTransitionStart: function(swiper) {
                            var pageContent = $(id).parents(".page-content");
                            $(pageContent).addClass("overflowhidden");
                            $(swiperWrap).find(".swiperTap li").attr("scroll", "0");
                        },
                        onTransitionEnd: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var swiperWrap = $(id + "-container");
                            $(swiperWrap).find(".swiperTap li").removeClass("scrollActive");
                            $(swiperWrap).find(".swiperTap").find("li").eq(activeIndex).addClass("scrollActive");
                            $(swiperWrap).find(".swiperTap li").attr("scroll", "1");
                            $(pageContent).removeClass("overflowhidden");
                        },
                        onSlideChangeEnd: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var swiperWrap = $(id + "-container");
                            var scrollTop = $(swiperWrap).find(".swiperTap li").eq(activeIndex).attr("scrollTop");
                            $(id).parents(".page-content").scrollTop(scrollTop);
                            $(pageContent).removeClass("overflowhidden");
                        },
                        onSlideChangeStart: function(swiper) {
                            var activeIndex = swiper.activeIndex;
                            var slideActive = $(id).find(".swiper-slide").eq(activeIndex);
                            $(id).find(".swiper-slide").addClass("swiper-slide-hide");
                            slideActive.removeClass("swiper-slide-hide");
                            var load = slideActive.attr("load");
                            var name = slideActive.attr("name");
                            if (load != 1 && name) {
                                app.routePage(name, slideActive, 1);
                                slideActive.attr("load", 1);
                            }
                            var swiperWrap = $(id + "-container");
                            $(swiperWrap).find(".swiperTap li").removeClass("active");
                            $(swiperWrap).find(".swiperTap li").eq(activeIndex).addClass("active");
                            //alert(callblack);
                            //滚动到原来位置
                            // alert($(slideActive).height());
                            //$(id).height(($(slideActive).height()));
                            callblack ? callblack(swiper) : "";
                        },
                        onTouchMove: function(swiper, e) {
                            var activeIndex = swiper.activeIndex;
                            var container = $(id + "-container");
                            var transform = $(container).find(".swiper-wrapper").css("transform");
                            var w = swiper.width;
                            var li_w = $(container).find(".swiperTap li").eq(activeIndex).width();
                            if (typeof transform == "string" && transform && transform.indexOf("translate3d(") == "0") {
                                if (transform.indexOf("translate3d(") == "0") {
                                    var transforms = transform.substring(13).split(",");
                                    var transformsW = Number(transforms[0].replace(/px/g, ""));
                                    var transform_x = (transformsW - activeIndex * w) / w * li_w;
                                }
                            } else {
                                return false;
                            }
                            $(container).parents(".page").find(".nav-tab-fix li").eq(activeIndex).find(".swiperTapLine").css("left", transform_x + "px");
                            if ($(container).parents(".page").find(".nav-tab-fix li").length) {
                                $(container).find(".swiperTap li").eq(activeIndex).find(".swiperTapLine").css("left", transform_x + "px");
                            }
                        },
                        onTouchEnd: function(swiper, e) {
                            var container = $(id + "-container");
                            var activeIndex = swiper.activeIndex;
                            $(container).find(".swiperTap li").find(".swiperTapLine").css("left", "0px");
                            if ($(container).parents(".page").find(".nav-tab-fix li").length) {
                                $(container).parents(".page").find(".nav-tab-fix li").find(".swiperTapLine").css("left", "0px");
                            }
                        }
                    });
                    //绑定点击事件
                    var length = $(id).find(".swiper-slide").length;
                    $(id + "-container").find(".swiperTap li").click(function(event) {
                        var index = $(this).index();
                        if (length > index) {
                            swiper.slideTo(index);
                        }
                    });
                    if ($(id + "-container").parents(".page").find(".nav-tab-fix li").length) {
                        $(id + "-container").parents(".page").find(".nav-tab-fix li").click(function(event) {
                            var index = $(this).index();
                            if (length > index) {
                                swiper.slideTo(index);
                            }
                        });
                    }
                }, false);
            },
            /*
             * Javascript base64_encode() base64加密函数
             用于生成字符串对应的base64加密字符串
             * 吴先成  www.51-n.com ohcc@163.com QQ:229256237
             * @param string str 原始字符串
             * @return string 加密后的base64字符串
             */
            base64_encode: function(str) {
                var c1, c2, c3;
                var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
                var i = 0, len = str.length, string = "";
                while (i < len) {
                    c1 = str.charCodeAt(i++) & 255;
                    if (i == len) {
                        string += base64EncodeChars.charAt(c1 >> 2);
                        string += base64EncodeChars.charAt((c1 & 3) << 4);
                        string += "==";
                        break;
                    }
                    c2 = str.charCodeAt(i++);
                    if (i == len) {
                        string += base64EncodeChars.charAt(c1 >> 2);
                        string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
                        string += base64EncodeChars.charAt((c2 & 15) << 2);
                        string += "=";
                        break;
                    }
                    c3 = str.charCodeAt(i++);
                    string += base64EncodeChars.charAt(c1 >> 2);
                    string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
                    string += base64EncodeChars.charAt((c2 & 15) << 2 | (c3 & 192) >> 6);
                    string += base64EncodeChars.charAt(c3 & 63);
                }
                return string;
            },
            /*
             * Javascript base64_decode() base64解密函数
             用于解密base64加密的字符串
             * 吴先成  www.51-n.com ohcc@163.com QQ:229256237
             * @param string str base64加密字符串
             * @return string 解密后的字符串
             */
            base64_decode: function(str) {
                var c1, c2, c3, c4;
                var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
                var i = 0, len = str.length, string = "";
                while (i < len) {
                    do {
                        c1 = base64DecodeChars[str.charCodeAt(i++) & 255];
                    } while (i < len && c1 == -1);
                    if (c1 == -1) break;
                    do {
                        c2 = base64DecodeChars[str.charCodeAt(i++) & 255];
                    } while (i < len && c2 == -1);
                    if (c2 == -1) break;
                    string += String.fromCharCode(c1 << 2 | (c2 & 48) >> 4);
                    do {
                        c3 = str.charCodeAt(i++) & 255;
                        if (c3 == 61) return string;
                        c3 = base64DecodeChars[c3];
                    } while (i < len && c3 == -1);
                    if (c3 == -1) break;
                    string += String.fromCharCode((c2 & 15) << 4 | (c3 & 60) >> 2);
                    do {
                        c4 = str.charCodeAt(i++) & 255;
                        if (c4 == 61) return string;
                        c4 = base64DecodeChars[c4];
                    } while (i < len && c4 == -1);
                    if (c4 == -1) break;
                    string += String.fromCharCode((c3 & 3) << 6 | c4);
                }
                return string;
            },
            //缓存
            cache: function(v) {
                var versions = v ? v : app.getVersions();
                var cacheFun = {
                    set: function(key, data) {
                        var value;
                        key = key + "_" + versions;
                        if (typeof data == "object") {
                            data = JSON.stringify(data);
                            value = "obj-" + data;
                        } else {
                            value = "str-" + data;
                        }
                        try {
                            localStorage.setItem(key, value);
                        } catch (err) {
                            if (err.name == "QuotaExceededError") {
                                localStorage.clear();
                                //如果缓存已满则清空
                                localStorage.setItem(key, value);
                            }
                        }
                    },
                    rm: function(key) {
                        key = key + "_" + versions;
                        localStorage.removeItem(key);
                    },
                    get: function(key) {
                        key = key + "_" + versions;
                        var value = localStorage.getItem(key);
                        if (value == null) {
                            return null;
                        }
                        var type = value.substr(0, 4);
                        if (type == "str-") {
                            return value.substr(4);
                        }
                        if (type == "obj-") {
                            var data = value.substr(4);
                            return $.parseJSON(data);
                        }
                    },
                    clear: function() {
                        localStorage.clear();
                    }
                };
                return cacheFun;
            },
            //微信默认分享
            wxDefShare: function(params) {
                if (typeof params == "undefined") {
                    var wxShareData = {
                        title: "跟着普象君有肉吃",
                        // 分享标题
                        imgUrl: "https://www.lgstatic.com/thumbnail_300x300/image1/M00/00/47/Cgo8PFTUXOOAbTbtAAA-0t30W6k220.jpg",
                        // 分享图标
                        desc: "等你好久了，终于来了"
                    };
                } else {
                    wxShareData = params;
                }
                app.wxShare(wxShareData);
            },
            // get vue vm
            getVm: function(name) {
                if (typeof name == "string") {
                    name = "js/" + name;
                    return seajs.Module.get(require.resolve(name)) && seajs.Module.get(require.resolve(name)).exports && seajs.Module.get(require.resolve(name)).exports.vm;
                } else {
                    return null;
                }
            },
            setPageData: function(pageName, data) {
                var curData = this.pageData[pageName] ? this.pageData[pageName] : {};
                // console.log("setPageData",data);
                for (var i in data) {
                    //console.log("i", i, data[i]);
                    curData[i] = data[i];
                }
                this.pageData[pageName] = curData;
            },
            getPageData: function(pageName, key) {
                var curData = this.pageData[pageName];
                if (key) {
                    return curData ? curData[key] : null;
                } else {
                    return curData;
                }
            },
            area: function(_this) {
                app.getScript("plug/area.js", function() {
                    $(_this).attr("domain", app.params.apiDomain);
                    $(_this).area();
                });
            },
            areaForbank: function(_this) {
                app.getScript("plug/areaForbank.js", function() {
                    $(_this).attr("domain", app.params.apiDomain);
                    $(_this).area();
                });
            },
            // 绑手机
            bindPhone: function() {
                // var params = app.GetRequest(window.location.search);
                var url = window.location.href;
                app.component("bindphone", {
                    title: "绑定手机号",
                    success: function(res) {
                        window.location.href = url;
                    }
                });
            },
            pay: function(order_sn, type) {
                var payurl = app.params.apiDomain + "apiv2/pay/run/?order_sn=" + order_sn;
                if (type) {
                    payurl += "&paytype=" + type;
                }
                var url = window.location.href;
                var Request = app.GetRequest(url);
                // 微信小程序
                if (Request.from_wx_app == "miniprogram") {
                    app.wxJs(function(wx) {
                        wx.miniProgram.navigateTo({
                            url: "/pages/pay/index?order_sn=" + order_sn
                        });
                    });
                    return;
                }
                // 去支付 
                if (url.indexOf("/app/?") > 0) {
                    app.showLoad();
                    if ($("#payBoxHide").length == 0) {
                        $("body").append('<div style="display:none" id="payBoxHide"></div>');
                    }
                    $("#payBoxHide").load(payurl, function() {
                        app.hideLoad();
                    });
                } else {
                    window.location.href = payurl;
                }
            }
        };
        $.extend(true, app, fun);
        return app;
    };
    module.exports = app;
});

"use strict";

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          listData: [],
          loading: 0,
          editData: {},
          showNewAddress: 0,
          area: [],
          type: 1,
          isWeiXin: 0,
          nodata: 0

        };
      },
      el: '#pageAddress',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {

        if (this.mounted == 1) {
          return;
        }
        var that = this;
        app.cityPicker("#areaAddress", {
          title: "选择地区",
          onChange: function onChange(picker, values, displayValues) {
            console.log(values);
            console.log(displayValues);
            that.area = displayValues;
            // that.cityName = displayValues[1];
            // that.countyName = displayValues[2];
          }
        });

        this.mounted = 1;
      },

      methods: {
        fetchData: function fetchData() {
          var _this = this;
          this.getList();
          this.type = this.$route.params.type;
          this.isWeiXin = app.isWeiXin();
          this.isWeiXin = app.isWeiXin();
        },
        getList: function getList() {
          var that = this;
          if (that.loading == 1) {
            return;
          }
          that.loading = 1;
          app.get("mall/user_address/get", {}, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            if (res.data.list.length === 0) {
              that.nodata = 1;
            } else {
              that.nodata = 0;
            }
            that.listData = res.data.list;
            // console.log(that.listData);
          });
        },

        // 微信中选择地址
        openAddress: function openAddress() {

          if (!app.isWeiXin()) {
            return;
          }
          var that = this;
          app.wxJs(function (wx) {

            wx.openAddress({
              success: function success(res) {
                console.log(res);
                that.editData = res;
                that.area = [res.provinceName, res.cityName, res.countryName];
                // console.log(res);
                // var userName = res.userName; // 收货人姓名
                // var postalCode = res.postalCode; // 邮编
                // var provinceName = res.provinceName; // 国标收货地址第一级地址（省）
                // var cityName = res.cityName; // 国标收货地址第二级地址（市）
                // var countryName = res.countryName; // 国标收货地址第三级地址（国家）
                // var detailInfo = res.detailInfo; // 详细收货地址信息
                // var nationalCode = res.nationalCode; // 收货地址国家码
                // var telNumber = res.telNumber; // 收货人手机号码
              },
              fail: function fail(res) {
                app.alert(res.errMsg);
              }
            });
          });
        },
        newAddress: function newAddress(index) {
          var that = this;
          // console.log(index);
          that.area = [];
          if (typeof index != "undefined") {
            this.editData = that.listData[index];
          } else {
            this.editData = {};
          }
          this.showNewAddress = 1;
        },
        saveAddress: function saveAddress() {
          var data = $("#pageAddress").find("#formNewAddress").serializeArray();
          if (this.area.length == 3) {
            data.push({
              name: 'provinceName',
              value: this.area[0]
            });
            data.push({
              name: 'cityName',
              value: this.area[1]
            });
            data.push({
              name: 'countryName',
              value: this.area[2]
            });
          }
          var that = this;
          if (that.loading == 1) {
            return;
          }
          that.loading = 1;
          app.post("mall/user_address/add", data, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            app.setPageData("address", { address: res.data });
            if (that.type == 1) {
              that.$router.go(-1);
            }
          });
        },
        selectAddress: function selectAddress(index) {
          // console.log(index);
          var data = this.listData[index];
          app.setPageData("address", { address: data });
          if (this.type == 1) {
            this.$router.go(-1);
          }
        },
        hideNewAddress: function hideNewAddress() {
          this.showNewAddress = 0;
        },
        delAddress: function delAddress() {
          var that = this;
          that.loading = 1;
          app.post("mall/user_address/del", {
            id: this.editData.id
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            that.getList();
            that.hideNewAddress();
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

"use strict";

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          shop_id: 0,
          shop_info: {},
          shoppingCartList: {},
          empty: 0,
          data: {}

        };
      },
      el: '#pageCart',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {},

      methods: {
        fetchData: function fetchData() {
          var _this = this;

          this.shop_id = this.$route.params.shop_id;
          this.getcartByUserId();
        },
        // 购物车
        getcartByUserId: function getcartByUserId() {
          var that = this;
          app.get("mall/cart/getcartByUserId", { shop_id: this.shop_id }, function (res) {
            if (res.code != 200) {
              app.alert(res.msg);
            } else if (res.data) {
              that.setData({ shoppingCartList: res.data, shop_info: res.data.shop_info });
            }
            if (res.data.count === 0) {
              that.setData({ "empty": 1 });
            }
          });
        },
        setData: function setData(arr) {
          for (var i in arr) {
            // console.log(i);
            // console.log(arr[i]);
            // this.$set(i,arr[i]); 
            this[i] = arr[i];
          }
        },

        //商品数量减
        minus: function minus(e) {
          var target = $(e.target);
          var id = target.attr("data-id");
          var shoppingCartList = this.shoppingCartList;
          if (shoppingCartList.list[id].count < 1) {
            shoppingCartList.list[id].count = 0;
          } else {
            shoppingCartList.list[id].count--;
          }
          this.setData({ shoppingCartList: shoppingCartList });
          this.addToCart({
            count: shoppingCartList.list[id].count,
            goods_spec_id: target.attr("data-goods_spec_id"), //  $(input).attr("goods_spec_id"),
            goods_id: target.attr("data-goods_id")
          });
        },
        //商品数量加
        plus: function plus(e) {
          var target = $(e.target);
          var id = target.attr("data-id");

          var shoppingCartList = this.shoppingCartList;
          shoppingCartList.list[id].count++;
          this.setData({ shoppingCartList: shoppingCartList });
          this.addToCart({
            count: shoppingCartList.list[id].count,
            goods_spec_id: target.attr("data-goods_spec_id"), //  $(input).attr("goods_spec_id"),
            goods_id: target.attr("data-goods_id")
          });
        },
        //商品数量
        changeCount: function changeCount(e) {

          var target = $(e.target);
          var id = target.attr("data-id");
          var count = target.val();
          var shoppingCartList = this.shoppingCartList;
          shoppingCartList.list[id].count = count;
          this.setData({ shoppingCartList: shoppingCartList });
          this.addToCart({
            count: count,
            goods_spec_id: target.attr("data-goods_spec_id"), //  $(input).attr("goods_spec_id"),
            goods_id: target.attr("data-goods_id")
          });
        },

        //加入购物车
        addToCart: function addToCart(post, callback) {

          var that = this;
          app.get("/mall/cart/add", post, function (res) {

            if (res.code != 200) {
              app.alert(res.msg);
            } else {
              callback ? callback(res) : '';
              that.setData({ shoppingCartList: res.data });
            }
          });
        },
        //清空购物车
        clearCart: function clearCart() {

          var that = this;
          app.confirm({
            text: '确定清空购物车吗？',
            yes: function yes() {
              app.get("mall/cart/clearCart", { shop_id: that.shop_id }, function (res) {
                if (res.code != 200) {
                  app.alert(res.msg);
                } else {
                  //phpkitApp.alert("恭喜,成功清空购物车!");
                  app.alert('恭喜,成功清空购物车!');
                  that.setData({ shoppingCartList: {
                      nextText: '去结算'
                    } });
                }
              });
            }
          });
        },
        //去结算
        settle_accounts: function settle_accounts() {
          this.$router.push({ name: 'checkout', params: { shop_id: this.shop_id } });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

"use strict";

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          shop_id: 0,
          shop_info: {},
          listData: [],
          empty: 0

        };
      },
      el: '#pageCartAll',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {},

      methods: {
        fetchData: function fetchData() {
          var _this = this;

          // this.shop_id = this.$route.params.shop_id;
          this.getcartByUserId();
        },
        // 购物车
        getcartByUserId: function getcartByUserId() {
          var that = this;
          app.get("mall/cart/getAllCart", function (res) {
            if (res.code != 200) {
              app.alert(res.msg);
            } else if (res.data) {
              that.listData = res.data;
            }
            if (res.data.count === 0) {
              that.setData({ "empty": 1 });
            }
          });
        },
        setData: function setData(arr) {
          for (var i in arr) {
            // console.log(i);
            // console.log(arr[i]);
            // this.$set(i,arr[i]); 
            this[i] = arr[i];
          }
        },
        //清空购物车
        clearCart: function clearCart(shop_id) {

          var that = this;
          app.confirm({
            text: '确定删除此购物车？',
            yes: function yes() {
              app.get("mall/cart/clearCart", { shop_id: shop_id }, function (res) {
                if (res.code != 200) {
                  app.alert(res.msg);
                } else {
                  //phpkitApp.alert("恭喜,成功清空购物车!");
                  app.alert('恭喜,成功清空购物车!');
                  that.getcartByUserId();
                }
              });
            }
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

"use strict";

define(function (require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function () {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {

                    loading: 0,
                    shop_id: 0,
                    listData: []

                };
            },
            el: '#pageCategory',
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {

                if (this.mounted == 1) {
                    return;
                }

                var that = this;

                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.shop_id = this.$route.params.shop_id;
                    this.loadList();
                },

                loadList: function loadList(reload) {
                    var that = this;

                    this.loading = 1;
                    app.get("mall/tag/getCategory", {
                        shop_id: this.shop_id
                    }, function (res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.listData = res.data;
                    });
                }

            }

        }).$mount('#app');
    };
    module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {

          data: {
            freight: {},
            list: [],
            shop_info: {},
            type: 0
          },
          loading: 0,
          frisload: 1,
          address: {},
          use_yie: 0,
          disabled: 0,
          location_info: '',
          shop_id: 0,
          card_code: '',
          order_amount: 0,
          multiArray: [],
          user_info: {},
          delivery_types: [],
          delivery_type: '送货上门',
          delivery_time: ['尽快送达', '2小时内'],
          delivery_coverage: 0,
          card_title: '',
          isWeiXin: 0
        };
      },
      el: '#pageCheckout',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {

        if (this.mounted == 1) {
          return;
        }
        // this.bindPick();
        var that = this;
        this.mounted = 1;
      },

      methods: {
        fetchData: function fetchData() {
          var _this = this;
          this.shop_id = this.$route.params.shop_id;
          this.isWeiXin = app.isWeiXin();
          this.getInfo();
        },

        bindPick: function bindPick() {
          var that = this;
          // console.log(that.multiArray[0]);

          if (that.multiArray && that.multiArray.length > 0) {
            app.picker("#chooseDeliveryType", {
              title: "选择配送时间",
              cols: [{
                textAlign: 'center',
                values: that.multiArray[0]
              }, {
                textAlign: 'center',
                values: that.multiArray[1]
              }, {
                textAlign: 'center',
                values: that.multiArray[2]
              }],
              onClose: function onClose(p) {
                // console.log( p);
                var v = p.displayValue;
                // console.log(v);
                that.bindChange(v);
              }
            });
            // $("#chooseDeliveryType").picker();
          }

          // console.log($("#bindChangeCeliveryC"));
          if (that.delivery_types && that.delivery_types.length > 0) {
            app.picker("#bindChangeCeliveryC", {
              title: "选择配送方式",
              cols: [{
                textAlign: 'center',
                values: that.delivery_types
              }],
              onClose: function onClose(p) {
                var v = p.displayValue;

                that.bindChangeCeliveryC(v);
                // that.bindChange(p, v, dv);
              }
            });
            // $("#bindChangeCeliveryC").picker();
          }
        },

        //选择配送公司
        bindChangeCeliveryC: function bindChangeCeliveryC(value) {
          // var value = e.detail.value;
          // console.log(value);
          // console.log(this.delivery_types);
          this.setData({
            delivery_type: value.join("")
          });
          this.loadCart(1);
        },
        //选择时间
        bindChange: function bindChange(dv) {
          //console.log(e.detail.value);
          // var value = e.detail.value;
          if (dv[1] > dv[2] && (dv[2] > "04:00" || dv[1] < "04:00")) {
            app.alert("您选择的时间段有误，请重新选择");
            return;
          }
          this.delivery_time = dv;
          console.log(this.delivery_time);
          // this.setData({ delivery_time:dv});
          // console.log(this.delivery_time);
          if (this.card_code) {
            this.loadCart(1);
          }
        },
        getInfo: function getInfo() {
          var that = this;
          app.get("api/user/info", {
            fields: "avatarUrl,user_id,last_update_time,nickname"
          }, function (res) {

            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }

            that.setData({ user_info: res.data });
          });
        },

        // 检查配送范围
        checkDistance: function checkDistance() {
          var that = this;
          if (!app.isWeiXin()) {
            return true;
          }
          if (!that.data.freight || !that.data.freight.delivery_coverage) {
            return true;
          }
          if (!that.location_info.latitude) {
            app.alert("请选择地址理位置");
          }

          if (that.location_info.latitude) {
            var s = that.getDistance(that.location_info.longitude, that.location_info.latitude, that.data.shop_info.longitude, that.data.shop_info.latitude);
            if (s > that.data.freight.delivery_coverage) {
              app.alert("配送范围：" + that.data.freight.delivery_coverage + "公里，您当前超出配送范围");
              return false;
            }
          }
          return true;
        },

        chooseLocation: function chooseLocation() {
          if (!app.isWeiXin()) {
            return;
          }
          var that = this;
          app.wxJs(function (wx) {
            wx.getLocation({
              cancel: function cancel(res) {
                app.alert("系统未能获取您的位置");
              },
              success: function success(res) {
                console.log("success", res);
                if (!(res.longitude && res.latitude)) {
                  return;
                }
                res.latitude = res.latitude.toFixed(5);
                res.longitude = res.longitude.toFixed(5);

                that.setData({ location_info: res });
              }
            });
          });
        },
        //计算两坐标的距离
        getDistance: function getDistance(lng1, lat1, lng2, lat2) {
          var radLat1 = lat1 * Math.PI / 180.0;
          var radLat2 = lat2 * Math.PI / 180.0;
          var a = radLat1 - radLat2;
          var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
          var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
          s = s * 6378.137; // EARTH_RADIUS;
          s = Math.round(s * 10000) / 10000;
          return s;
        },


        //打开商家所在地点
        openlocation: function openlocation() {
          if (!app.isWeiXin()) {
            return;
          }
          var that = this;
          app.wxJs(function (wx) {
            wx.openLocation({
              latitude: Number(that.data.shop_info.latitude),
              longitude: Number(that.data.shop_info.longitude),
              scale: 28,
              address: that.data.shop_info.fulladdress,
              name: that.data.shop_info.name
            });
          });
        },

        setData: function setData(arr) {
          for (var i in arr) {
            // console.log(i);
            // console.log(arr[i]);
            // this.$set(i,arr[i]); 
            this[i] = arr[i];
          }
        },
        //加载购物车
        loadCart: function loadCart() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          if (reload == 1) {
            this.setData({
              loading: 0,
              listData: []
            });
          }
          this.loading = 1;
          app.get("mall/cart/getcartByUserId", {
            shop_id: this.shop_id,
            card_code: this.card_code,
            delivery_type: this.delivery_type,
            deliver_time: this.delivery_time.join(",")
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            that.frisload = 0;
            // 卡券不可用
            if (res.data.cardRes && res.data.cardRes.code > 0) {
              app.alert(res.data.cardRes.msg);
              that.card_code = "";
              that.card_title = "";
            }
            //配送时间设置，及配送方式
            that.setData({
              data: res.data,
              multiArray: res.data.select_delivery_min_max_time,
              delivery_types: res.data.delivery_type
            });
            // 配送范畴
            if (res.data.freight && res.data.freight.delivery_coverage) {
              that.setData({
                delivery_coverage: res.data.freight.delivery_coverage
              });
            }
            // 配送可达时间
            if (res.data.freight && res.data.freight.EstimatedTimeOfArrival && that.frisload == 1) {
              that.setData({
                delivery_time: ['尽快送达', res.data.freight.EstimatedTimeOfArrival + '小时内']
              });
            }
            // 默认地址
            if (res.data.address) {
              that.address = res.data.address;
            }
            // console.log(that.multiArray);
            // 选择时间插件
            Vue.nextTick(function () {
              that.bindPick();
            });
          });
        },

        /**
        * 生命周期函数--监听页面显示
        */
        pageShow: function pageShow() {
          // console.log("23123");
          var reload = app.getPageData("checkout/index", 'reload');
          var address = app.getPageData("address", 'address');

          if (reload == 1) {
            app.setPageData("checkout/index", { reload: 0 });
            this.loadCart(1);
          }

          if (address) {
            this.address = address;
          }

          this.loadCart();
        },
        suc: function suc() {},
        //生成订单
        formSubmit: function formSubmit(e) {

          var that = this;
          that.setData({ loading: 1, disabled: 1 });
          that.payloading = 1;
          if (!this.address.telNumber && this.data.type === 0) {
            app.alert("请选择收货地址");
            that.setData({ loading: 0, disabled: 0 });
            return false;
          }
          // console.log(this.delivery_type);
          // 微信中可以计算配送距离
          // if (!this.checkDistance()) {
          //   // app.alert("请选择地理位置");
          //   that.setData({ loading: 0, disabled: 0 });
          //   return false;
          // }
          var remark = $("#pageCheckout").find("[name='remark']").val();
          app.post("api/pay/mall_order", {
            remark: remark,
            address: JSON.stringify(this.address),
            shop_id: this.shop_id,
            use_yie: this.use_yie,
            card_code: this.card_code,
            location_info: JSON.stringify(this.location_info),
            delivery_type: this.delivery_type,
            deliver_time: this.delivery_time.join(",")
          }, function (res) {
            if (res.code != 200) {
              app.alert(res.msg);
              that.payloading = 0;
              that.setData({ 'loading': 0 });
              that.setData({ 'disabled': 0 });
              return false;
            }
            var order_sn = res.data.order_sn;
            app.pay(order_sn);
            console.log(order_sn);
          });
        },
        moreAct: function moreAct(e) {
          var that = this;
          var itemListArray = [];
          var goods_id = e.currentTarget.dataset.goods_id;
          var goods_spec_id = e.currentTarget.dataset.goods_spec_id;
        },
        //选择卡券
        chooseCard: function chooseCard() {
          var that = this;
          app.component("card", {
            success: function success(res) {
              that.$router.go(-1);
              that.card_code = res.card_code;
              that.card_title = res.card_title;
              that.loadCart(1);
            }
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          data: {},
          popup: 0,
          choose_property_data: {},
          choose_property_data_copy: {},
          choose_spec: {},
          disabled: 1,
          shopInfo: {},
          shop_id: 0,
          spec_keys_str: ''
        };
      },
      el: '#pageGoods',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {

        if (this.mounted == 1) {
          return;
        }

        var that = this;
        app.swiper("swiper-container-520275");
        this.mounted = 1;
      },
      methods: {
        fetchData: function fetchData() {
          var _this = this;
          this.id = this.$route.params.id;
          this.loadGoodInfo();
        },
        chooseSpec: function chooseSpec() {
          // this.popup=1;
          console.log(123);
          app.show_popup($("#popup_goods"));
          // this.setData({ popup: 1 })
        },
        btn_cancel: function btn_cancel() {
          // this.popup=0;
          // this.setData({ popup:0});
          app.hide_popup($("#popup_goods"));
        },
        //选规格
        chooseProperty: function chooseProperty(e) {
          // console.log(e); 
          var property = $(e.target).attr("data-property");
          var subProperty = $(e.target).attr("data-sub-property");
          this.choose_property_data_copy = {};
          this.choose_property_data[property] = subProperty;

          var arr = [];
          for (var i in this.choose_property_data) {
            arr.push(this.choose_property_data[i]);
          }
          // console.log(this.data.property_arr.length);

          if (arr.length == this.data.property_arr.length) {
            this.spec_keys_str = arr.join(" ");
            // this.setData({ spec_keys_str: arr.join(" ") });
            var l = arr.length;
            for (var j = 0; j < 5 - l; j++) {
              arr.push("");
            }
            // console.log(arr,arr);
            var spec_keys = arr.sort();
            var spec_keys_str = spec_keys.join("_");
            if (this.data.goods_spec[spec_keys_str] && this.data.goods_spec[spec_keys_str].spec_stock > 0) {
              this.choose_spec = this.data.goods_spec[spec_keys_str];
              this.disabled = 0;
            } else {
              app.alert('已售空');
              this.disabled = 1;
              // this.setData({ disabled:1});
            }
          }
          this.choose_property_data_copy = this.choose_property_data;
          // console.log(this.choose_property_data_copy);

          // console.log(this.choose_spec);
          //choose_spec
        },
        //加载购物车
        loadGoodInfo: function loadGoodInfo() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          if (reload == 1) {
            this.loading = 0;
            this.data = {};
          }
          this.loading = 1;
          app.get("mall/goods/find", {
            id: this.id
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            that.data = res.data;
            that.shop_id = res.data.shop_id;
            that.getShopInfo();
            app.setTitle(res.data.goods_name);
            if (that.data.property_arr.length > 0) {
              that.disabled = 1;
            } else {
              that.disabled = 0;
            }
          });
        },

        gotCart: function gotCart() {

          this.$router.push({ name: 'cart', params: { shop_id: this.shop_id } });
        },

        getShopInfo: function getShopInfo() {
          var that = this;
          app.get("/mall/shop/find", { id: this.shop_id }, function (res) {

            if (res.code != 200) {
              app.alert(res.msg);
            } else {

              that.shopInfo = res.data;
            }
          });
        },

        buyNow: function buyNow(e) {
          // console.log(e);
          var postData = {};
          var type = $(e.target).attr("data-type");
          if (this.data.property_arr.length > 0 && this.choose_spec.spec_stock > 0) {
            postData.goods_id = this.choose_spec.goods_id;
            postData.goods_spec_id = this.choose_spec.id;
            //可以去结算
          } else if (this.data.property_arr.length === 0) {
            postData.goods_id = this.data.id;
          } else {
            this.chooseSpec();
            return;
          }
          //加入购车
          this.loading = 1;
          var that = this;
          this.loading = 1;
          this.disabled = 1;
          app.get("mall/cart/add", postData, function (res) {
            that.loading = 0;
            that.loading = 0;
            that.disabled = 0;

            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            // console.log();
            if (type == "buyNow") {
              that.$router.push({ name: 'checkout', params: { shop_id: res.data.shop_id } });
            } else {
              that.btn_cancel();
              app.confirm({
                text: '成功加入购物车',
                confirmText: '去结算',
                cancelText: '返回',
                yes: function yes() {

                  that.$router.push({ name: 'checkout', params: { shop_id: res.data.shop_id } });
                },
                no: function no() {

                  that.$router.go(-1);
                }
              });
            }
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

'use strict';

define(function (require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function () {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    pid: 0,
                    from: 'wx',
                    showType: 1,
                    weui_icon: '',
                    weui_msg_title: '',
                    weui_msg_desc: ''

                };
            },
            el: '#pageIndex',
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.from = this.$route.params.from;
                    var user_info = app.getUserInfo();
                    if (this.from == 'app') {
                        this.showType = 3;
                        app.get("apiv2/mch/mch_info_search", {
                            store_id: 281 //user_info.store_id
                        }, function (res) {
                            if (res.code == 200) {
                                _this.merchant = res.data;
                                _this.showType = 2;
                                if (_this.merchant.status < 1) {
                                    _this.weui_icon = 'weui_icon_waiting weui_icon_msg';
                                    _this.weui_msg_title = "申请已提交，审核中...";
                                    _this.weui_msg_desc = "我们将在一个工作日完成审核。";
                                }
                                if (_this.merchant.status == 1) {
                                    _this.weui_icon = 'weui_icon_success weui_icon_msg';
                                    _this.weui_msg_title = "通过审核";
                                    _this.weui_msg_desc = "资料已通审核，可正常使用收款功能。";
                                }
                                if (_this.merchant.status == 2) {
                                    _this.weui_icon = 'weui_icon_warn weui_icon_msg';
                                    _this.weui_msg_title = "审核不通";
                                    _this.weui_msg_desc = "原因：" + _this.merchant.statusInfo.examineStatusRemark + "。";
                                }
                            } else {
                                _this.showType = 1;
                            }
                        });
                    }
                },
                reapply: function reapply() {
                    this.showType = 1;
                }

            }

        }).$mount('#app');
    };
    module.exports = controller;
});

'use strict';

define(function (require) {
    var PuthinkApp = require('app');
    //vue 组件
    // require('js/component');
    //zach
    //配置文件
    var params = {
        apiDomain: seajs.data.apiDomain ? seajs.data.apiDomain : 'https://www.bestsmartbee.com/', //接口域名 不带"/"
        domain: '', //网站域名  不带"/",
        appname: seajs.data.appname,
        debug: seajs.data.debug ? seajs.data.debug : false,
        versions: seajs.data.versions ? seajs.data.versions : '6.8',
        userVersions: seajs.data.userVersions ? seajs.data.userVersions : '6.9'
    };

    //app 实例之后 ， 只执行一次
    PuthinkApp.afterInit = function () {
        var _hmt = _hmt || [];
    };

    //页面显示时引用，每次都会执行
    PuthinkApp.pageShow = function (params) {
        var name = params.name;
        // console.log();
    };

    //实例化app
    window.app = new PuthinkApp(params);
    app.login(function () {
        app.init();
    });
});

'use strict';

define(function (require, exports, module) {
    var Router = new VueRouter({
        routes: [{
            path: '/',
            name: 'index',
            page: 'cache',
            title: '商品分类'
        }, {
            path: '/tag/:tag_id',
            name: 'tag',
            title: '商品列表'
        }, {
            path: '/goods/:id',
            name: 'goods',
            title: '商品详情'
        }, {
            path: '/checkout/:shop_id',
            page: 'cache',
            name: 'checkout',
            title: '结算'
        }, {
            path: '/cart/:shop_id',
            name: 'cart',
            title: '购物车'
        }, {
            path: '/cartAll',
            name: 'cartAll',
            title: '我的购物车'
        }, {
            path: '/address/:type',
            name: 'address',
            title: '地址管理'
        }, {
            path: '/category/:shop_id',
            name: 'category',
            title: '分类'
        }, {
            path: '/shop_list/shop_id/:shop_id/tag_id/:tag_id',
            name: 'shopList',
            title: '商家列表'
        }]
    });
    module.exports = Router;
});

'use strict';

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          shop_info: {},
          loading: 0,
          page: 1,
          status: 0,
          lastpage: 0,
          listData: [],
          tag_id: 0,
          shop_id: 0,
          nodata: 0,
          order: 'MallShopProvider.id desc'
        };
      },
      el: '#pageShopList',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {

        if (this.mounted == 1) {
          return;
        }

        var that = this;
        app.pager("#pageShopList", function () {
          that.loadList();
        });
        this.mounted = 1;
      },
      methods: {
        fetchData: function fetchData() {
          var _this = this;
          this.shop_id = this.$route.params.shop_id;
          this.tag_id = this.$route.params.tag_id;
          this.loadList();
          this.loadTagInfo();
        },
        loadTagInfo: function loadTagInfo() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          if (reload == 1) {
            this.loading = 0;
            this.data = {};
          }
          this.loading = 1;
          app.get("mall/tag/find", {
            id: this.tag_id
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            app.setTitle(res.data.name);
          });
        },


        setOrder: function setOrder(e) {
          var order = e.currentTarget.dataset.order;

          if (this.order == order) {
            return;
          }
          this.order = order;
          // this.setData({ order: order });
          this.loadList(1);
          //console.log(e);
        },

        loadList: function loadList(reload) {
          var that = this;

          if (reload == 1) {
            this.loading = 0;
            this.page = 1;
            this.lastpage = 0;
            this.listData = [];
          }

          var page = this.page;
          if (this.loading == 1 || this.lastpage == 1) {
            // console.log('12');
            return;
          }
          this.loading = 1;
          app.get("mall/shop_provider/get", {
            page: page,
            limit: 30,
            provider_shop_id: this.shop_id,
            tag_id: this.tag_id,
            order: this.order
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            if (res.data.list.length === 0) {
              that.lastpage = 1;
            }
            that.page++;
            that.listData = that.listData.concat(res.data.list);
            if (that.listData.length > 0) {
              that.nodata = 0;
            } else {
              that.nodata = 1;
            }
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

"use strict";

define(function (require, exports, module) {
  var router = require("router");
  //var app = require("app");
  var controller = {};
  controller.vue = function () {
    controller.vm = new Vue({
      router: router,
      data: function data() {
        return {
          shop_info: {},
          loading: 0,
          page: 1,
          status: 0,
          lastpage: 0,
          listData: [],
          tag_id: 26,
          order: "MallGoods.order_by desc"
        };
      },
      el: '#pageTag',
      created: function created() {
        this.fetchData();
      },
      mounted: function mounted() {

        if (this.mounted == 1) {
          return;
        }

        var that = this;
        app.pager("#pageTag", function () {
          that.loadList();
        });
        this.mounted = 1;
      },
      methods: {
        fetchData: function fetchData() {
          var _this = this;
          this.tag_id = this.$route.params.tag_id;
          this.loadList();
          this.loadTagInfo();
        },
        loadTagInfo: function loadTagInfo() {
          var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

          var that = this;
          if (reload == 1) {
            this.loading = 0;
            this.data = {};
          }
          this.loading = 1;
          app.get("mall/tag/find", {
            id: this.tag_id
          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            app.setTitle(res.data.name);
          });
        },


        setOrder: function setOrder(e) {
          var order = e.currentTarget.dataset.order;
          if (order == "price") {
            order = this.order == "MallGoods.price" ? 'MallGoods.price desc' : "MallGoods.price";
          }
          if (this.order == order) {
            return;
          }
          this.order = order;
          // this.setData({ order: order });
          this.loadList(1);
          //console.log(e);
        },

        loadList: function loadList(reload) {
          var that = this;

          if (reload == 1) {
            this.loading = 0;
            this.page = 1;
            this.lastpage = 0;
            this.listData = [];
          }

          var page = this.page;
          if (this.loading == 1 || this.lastpage == 1) {
            // console.log('12');
            return;
          }
          this.loading = 1;
          app.get("mall/goods/get", {
            page: page,
            limit: 30,
            tag_id: this.tag_id,
            order: this.order,
            fields: 'id,goods_name,total_stock,origin_price,price,sub_title,order_count,shop_id,default_img'

          }, function (res) {
            that.loading = 0;
            if (res.code != 200) {
              app.alert(res.msg);
              return;
            }
            if (res.data.list.length === 0) {
              that.lastpage = 1;
            }
            that.page++;
            that.listData = that.listData.concat(res.data.list);
          });
        }

      }

    }).$mount('#app');
  };
  module.exports = controller;
});

"use strict";

define("./js/address", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    listData: [],
                    loading: 0,
                    editData: {},
                    showNewAddress: 0,
                    area: [],
                    type: 1,
                    isWeiXin: 0,
                    nodata: 0
                };
            },
            el: "#pageAddress",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                app.cityPicker("#areaAddress", {
                    title: "选择地区",
                    onChange: function onChange(picker, values, displayValues) {
                        console.log(values);
                        console.log(displayValues);
                        that.area = displayValues;
                    }
                });
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.getList();
                    this.type = this.$route.params.type;
                    this.isWeiXin = app.isWeiXin();
                    this.isWeiXin = app.isWeiXin();
                },
                getList: function getList() {
                    var that = this;
                    if (that.loading == 1) {
                        return;
                    }
                    that.loading = 1;
                    app.get("mall/user_address/get", {}, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        if (res.data.list.length === 0) {
                            that.nodata = 1;
                        } else {
                            that.nodata = 0;
                        }
                        that.listData = res.data.list;
                    });
                },
                // 微信中选择地址
                openAddress: function openAddress() {
                    if (!app.isWeiXin()) {
                        return;
                    }
                    var that = this;
                    app.wxJs(function(wx) {
                        wx.openAddress({
                            success: function success(res) {
                                console.log(res);
                                that.editData = res;
                                that.area = [ res.provinceName, res.cityName, res.countryName ];
                            },
                            fail: function fail(res) {
                                app.alert(res.errMsg);
                            }
                        });
                    });
                },
                newAddress: function newAddress(index) {
                    var that = this;
                    // console.log(index);
                    that.area = [];
                    if (typeof index != "undefined") {
                        this.editData = that.listData[index];
                    } else {
                        this.editData = {};
                    }
                    this.showNewAddress = 1;
                },
                saveAddress: function saveAddress() {
                    var data = $("#pageAddress").find("#formNewAddress").serializeArray();
                    if (this.area.length == 3) {
                        data.push({
                            name: "provinceName",
                            value: this.area[0]
                        });
                        data.push({
                            name: "cityName",
                            value: this.area[1]
                        });
                        data.push({
                            name: "countryName",
                            value: this.area[2]
                        });
                    }
                    var that = this;
                    if (that.loading == 1) {
                        return;
                    }
                    that.loading = 1;
                    app.post("mall/user_address/add", data, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        app.setPageData("address", {
                            address: res.data
                        });
                        if (that.type == 1) {
                            that.$router.go(-1);
                        }
                    });
                },
                selectAddress: function selectAddress(index) {
                    // console.log(index);
                    var data = this.listData[index];
                    app.setPageData("address", {
                        address: data
                    });
                    if (this.type == 1) {
                        this.$router.go(-1);
                    }
                },
                hideNewAddress: function hideNewAddress() {
                    this.showNewAddress = 0;
                },
                delAddress: function delAddress() {
                    var that = this;
                    that.loading = 1;
                    app.post("mall/user_address/del", {
                        id: this.editData.id
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.getList();
                        that.hideNewAddress();
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/cart", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    shop_id: 0,
                    shop_info: {},
                    shoppingCartList: {},
                    empty: 0,
                    data: {}
                };
            },
            el: "#pageCart",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {},
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.shop_id = this.$route.params.shop_id;
                    this.getcartByUserId();
                },
                // 购物车
                getcartByUserId: function getcartByUserId() {
                    var that = this;
                    app.get("mall/cart/getcartByUserId", {
                        shop_id: this.shop_id
                    }, function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                        } else if (res.data) {
                            that.setData({
                                shoppingCartList: res.data,
                                shop_info: res.data.shop_info
                            });
                        }
                        if (res.data.count === 0) {
                            that.setData({
                                empty: 1
                            });
                        }
                    });
                },
                setData: function setData(arr) {
                    for (var i in arr) {
                        // console.log(i);
                        // console.log(arr[i]);
                        // this.$set(i,arr[i]); 
                        this[i] = arr[i];
                    }
                },
                //商品数量减
                minus: function minus(e) {
                    var target = $(e.target);
                    var id = target.attr("data-id");
                    var shoppingCartList = this.shoppingCartList;
                    if (shoppingCartList.list[id].count < 1) {
                        shoppingCartList.list[id].count = 0;
                    } else {
                        shoppingCartList.list[id].count--;
                    }
                    this.setData({
                        shoppingCartList: shoppingCartList
                    });
                    this.addToCart({
                        count: shoppingCartList.list[id].count,
                        goods_spec_id: target.attr("data-goods_spec_id"),
                        //  $(input).attr("goods_spec_id"),
                        goods_id: target.attr("data-goods_id")
                    });
                },
                //商品数量加
                plus: function plus(e) {
                    var target = $(e.target);
                    var id = target.attr("data-id");
                    var shoppingCartList = this.shoppingCartList;
                    shoppingCartList.list[id].count++;
                    this.setData({
                        shoppingCartList: shoppingCartList
                    });
                    this.addToCart({
                        count: shoppingCartList.list[id].count,
                        goods_spec_id: target.attr("data-goods_spec_id"),
                        //  $(input).attr("goods_spec_id"),
                        goods_id: target.attr("data-goods_id")
                    });
                },
                //商品数量
                changeCount: function changeCount(e) {
                    var target = $(e.target);
                    var id = target.attr("data-id");
                    var count = target.val();
                    var shoppingCartList = this.shoppingCartList;
                    shoppingCartList.list[id].count = count;
                    this.setData({
                        shoppingCartList: shoppingCartList
                    });
                    this.addToCart({
                        count: count,
                        goods_spec_id: target.attr("data-goods_spec_id"),
                        //  $(input).attr("goods_spec_id"),
                        goods_id: target.attr("data-goods_id")
                    });
                },
                //加入购物车
                addToCart: function addToCart(post, callback) {
                    var that = this;
                    app.get("/mall/cart/add", post, function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                        } else {
                            callback ? callback(res) : "";
                            that.setData({
                                shoppingCartList: res.data
                            });
                        }
                    });
                },
                //清空购物车
                clearCart: function clearCart() {
                    var that = this;
                    app.confirm({
                        text: "确定清空购物车吗？",
                        yes: function yes() {
                            app.get("mall/cart/clearCart", {
                                shop_id: that.shop_id
                            }, function(res) {
                                if (res.code != 200) {
                                    app.alert(res.msg);
                                } else {
                                    //phpkitApp.alert("恭喜,成功清空购物车!");
                                    app.alert("恭喜,成功清空购物车!");
                                    that.setData({
                                        shoppingCartList: {
                                            nextText: "去结算"
                                        }
                                    });
                                }
                            });
                        }
                    });
                },
                //去结算
                settle_accounts: function settle_accounts() {
                    this.$router.push({
                        name: "checkout",
                        params: {
                            shop_id: this.shop_id
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/cartAll", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    shop_id: 0,
                    shop_info: {},
                    listData: [],
                    empty: 0
                };
            },
            el: "#pageCartAll",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {},
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    // this.shop_id = this.$route.params.shop_id;
                    this.getcartByUserId();
                },
                // 购物车
                getcartByUserId: function getcartByUserId() {
                    var that = this;
                    app.get("mall/cart/getAllCart", function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                        } else if (res.data) {
                            that.listData = res.data;
                        }
                        if (res.data.count === 0) {
                            that.setData({
                                empty: 1
                            });
                        }
                    });
                },
                setData: function setData(arr) {
                    for (var i in arr) {
                        // console.log(i);
                        // console.log(arr[i]);
                        // this.$set(i,arr[i]); 
                        this[i] = arr[i];
                    }
                },
                //清空购物车
                clearCart: function clearCart(shop_id) {
                    var that = this;
                    app.confirm({
                        text: "确定删除此购物车？",
                        yes: function yes() {
                            app.get("mall/cart/clearCart", {
                                shop_id: shop_id
                            }, function(res) {
                                if (res.code != 200) {
                                    app.alert(res.msg);
                                } else {
                                    //phpkitApp.alert("恭喜,成功清空购物车!");
                                    app.alert("恭喜,成功清空购物车!");
                                    that.getcartByUserId();
                                }
                            });
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/category", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    loading: 0,
                    shop_id: 0,
                    listData: []
                };
            },
            el: "#pageCategory",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.shop_id = this.$route.params.shop_id;
                    this.loadList();
                },
                loadList: function loadList(reload) {
                    var that = this;
                    this.loading = 1;
                    app.get("mall/tag/getCategory", {
                        shop_id: this.shop_id
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.listData = res.data;
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/checkout", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: {
                        freight: {},
                        list: [],
                        shop_info: {},
                        type: 0
                    },
                    loading: 0,
                    frisload: 1,
                    address: {},
                    use_yie: 0,
                    disabled: 0,
                    location_info: "",
                    shop_id: 0,
                    card_code: "",
                    order_amount: 0,
                    multiArray: [],
                    user_info: {},
                    delivery_types: [],
                    delivery_type: "送货上门",
                    delivery_time: [ "尽快送达", "2小时内" ],
                    delivery_coverage: 0,
                    card_title: "",
                    isWeiXin: 0
                };
            },
            el: "#pageCheckout",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                // this.bindPick();
                var that = this;
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.shop_id = this.$route.params.shop_id;
                    this.isWeiXin = app.isWeiXin();
                    this.getInfo();
                },
                bindPick: function bindPick() {
                    var that = this;
                    // console.log(that.multiArray[0]);
                    if (that.multiArray && that.multiArray.length > 0) {
                        app.picker("#chooseDeliveryType", {
                            title: "选择配送时间",
                            cols: [ {
                                textAlign: "center",
                                values: that.multiArray[0]
                            }, {
                                textAlign: "center",
                                values: that.multiArray[1]
                            }, {
                                textAlign: "center",
                                values: that.multiArray[2]
                            } ],
                            onClose: function onClose(p) {
                                // console.log( p);
                                var v = p.displayValue;
                                // console.log(v);
                                that.bindChange(v);
                            }
                        });
                    }
                    // console.log($("#bindChangeCeliveryC"));
                    if (that.delivery_types && that.delivery_types.length > 0) {
                        app.picker("#bindChangeCeliveryC", {
                            title: "选择配送方式",
                            cols: [ {
                                textAlign: "center",
                                values: that.delivery_types
                            } ],
                            onClose: function onClose(p) {
                                var v = p.displayValue;
                                that.bindChangeCeliveryC(v);
                            }
                        });
                    }
                },
                //选择配送公司
                bindChangeCeliveryC: function bindChangeCeliveryC(value) {
                    // var value = e.detail.value;
                    // console.log(value);
                    // console.log(this.delivery_types);
                    this.setData({
                        delivery_type: value.join("")
                    });
                    this.loadCart(1);
                },
                //选择时间
                bindChange: function bindChange(dv) {
                    //console.log(e.detail.value);
                    // var value = e.detail.value;
                    if (dv[1] > dv[2] && (dv[2] > "04:00" || dv[1] < "04:00")) {
                        app.alert("您选择的时间段有误，请重新选择");
                        return;
                    }
                    this.delivery_time = dv;
                    console.log(this.delivery_time);
                    // this.setData({ delivery_time:dv});
                    // console.log(this.delivery_time);
                    if (this.card_code) {
                        this.loadCart(1);
                    }
                },
                getInfo: function getInfo() {
                    var that = this;
                    app.get("api/user/info", {
                        fields: "avatarUrl,user_id,last_update_time,nickname"
                    }, function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.setData({
                            user_info: res.data
                        });
                    });
                },
                // 检查配送范围
                checkDistance: function checkDistance() {
                    var that = this;
                    if (!app.isWeiXin()) {
                        return true;
                    }
                    if (!that.data.freight || !that.data.freight.delivery_coverage) {
                        return true;
                    }
                    if (!that.location_info.latitude) {
                        app.alert("请选择地址理位置");
                    }
                    if (that.location_info.latitude) {
                        var s = that.getDistance(that.location_info.longitude, that.location_info.latitude, that.data.shop_info.longitude, that.data.shop_info.latitude);
                        if (s > that.data.freight.delivery_coverage) {
                            app.alert("配送范围：" + that.data.freight.delivery_coverage + "公里，您当前超出配送范围");
                            return false;
                        }
                    }
                    return true;
                },
                chooseLocation: function chooseLocation() {
                    if (!app.isWeiXin()) {
                        return;
                    }
                    var that = this;
                    app.wxJs(function(wx) {
                        wx.getLocation({
                            cancel: function cancel(res) {
                                app.alert("系统未能获取您的位置");
                            },
                            success: function success(res) {
                                console.log("success", res);
                                if (!(res.longitude && res.latitude)) {
                                    return;
                                }
                                res.latitude = res.latitude.toFixed(5);
                                res.longitude = res.longitude.toFixed(5);
                                that.setData({
                                    location_info: res
                                });
                            }
                        });
                    });
                },
                //计算两坐标的距离
                getDistance: function getDistance(lng1, lat1, lng2, lat2) {
                    var radLat1 = lat1 * Math.PI / 180;
                    var radLat2 = lat2 * Math.PI / 180;
                    var a = radLat1 - radLat2;
                    var b = lng1 * Math.PI / 180 - lng2 * Math.PI / 180;
                    var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
                    s = s * 6378.137;
                    // EARTH_RADIUS;
                    s = Math.round(s * 1e4) / 1e4;
                    return s;
                },
                //打开商家所在地点
                openlocation: function openlocation() {
                    if (!app.isWeiXin()) {
                        return;
                    }
                    var that = this;
                    app.wxJs(function(wx) {
                        wx.openLocation({
                            latitude: Number(that.data.shop_info.latitude),
                            longitude: Number(that.data.shop_info.longitude),
                            scale: 28,
                            address: that.data.shop_info.fulladdress,
                            name: that.data.shop_info.name
                        });
                    });
                },
                setData: function setData(arr) {
                    for (var i in arr) {
                        // console.log(i);
                        // console.log(arr[i]);
                        // this.$set(i,arr[i]); 
                        this[i] = arr[i];
                    }
                },
                //加载购物车
                loadCart: function loadCart() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        this.setData({
                            loading: 0,
                            listData: []
                        });
                    }
                    this.loading = 1;
                    app.get("mall/cart/getcartByUserId", {
                        shop_id: this.shop_id,
                        card_code: this.card_code,
                        delivery_type: this.delivery_type,
                        deliver_time: this.delivery_time.join(",")
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.frisload = 0;
                        // 卡券不可用
                        if (res.data.cardRes && res.data.cardRes.code > 0) {
                            app.alert(res.data.cardRes.msg);
                            that.card_code = "";
                            that.card_title = "";
                        }
                        //配送时间设置，及配送方式
                        that.setData({
                            data: res.data,
                            multiArray: res.data.select_delivery_min_max_time,
                            delivery_types: res.data.delivery_type
                        });
                        // 配送范畴
                        if (res.data.freight && res.data.freight.delivery_coverage) {
                            that.setData({
                                delivery_coverage: res.data.freight.delivery_coverage
                            });
                        }
                        // 配送可达时间
                        if (res.data.freight && res.data.freight.EstimatedTimeOfArrival && that.frisload == 1) {
                            that.setData({
                                delivery_time: [ "尽快送达", res.data.freight.EstimatedTimeOfArrival + "小时内" ]
                            });
                        }
                        // 默认地址
                        if (res.data.address) {
                            that.address = res.data.address;
                        }
                        // console.log(that.multiArray);
                        // 选择时间插件
                        Vue.nextTick(function() {
                            that.bindPick();
                        });
                    });
                },
                /**
        * 生命周期函数--监听页面显示
        */
                pageShow: function pageShow() {
                    // console.log("23123");
                    var reload = app.getPageData("checkout/index", "reload");
                    var address = app.getPageData("address", "address");
                    if (reload == 1) {
                        app.setPageData("checkout/index", {
                            reload: 0
                        });
                        this.loadCart(1);
                    }
                    if (address) {
                        this.address = address;
                    }
                    this.loadCart();
                },
                suc: function suc() {},
                //生成订单
                formSubmit: function formSubmit(e) {
                    var that = this;
                    that.setData({
                        loading: 1,
                        disabled: 1
                    });
                    that.payloading = 1;
                    if (!this.address.telNumber && this.data.type === 0) {
                        app.alert("请选择收货地址");
                        that.setData({
                            loading: 0,
                            disabled: 0
                        });
                        return false;
                    }
                    // console.log(this.delivery_type);
                    // 微信中可以计算配送距离
                    // if (!this.checkDistance()) {
                    //   // app.alert("请选择地理位置");
                    //   that.setData({ loading: 0, disabled: 0 });
                    //   return false;
                    // }
                    var remark = $("#pageCheckout").find("[name='remark']").val();
                    app.post("api/pay/mall_order", {
                        remark: remark,
                        address: JSON.stringify(this.address),
                        shop_id: this.shop_id,
                        use_yie: this.use_yie,
                        card_code: this.card_code,
                        location_info: JSON.stringify(this.location_info),
                        delivery_type: this.delivery_type,
                        deliver_time: this.delivery_time.join(",")
                    }, function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                            that.payloading = 0;
                            that.setData({
                                loading: 0
                            });
                            that.setData({
                                disabled: 0
                            });
                            return false;
                        }
                        var order_sn = res.data.order_sn;
                        app.pay(order_sn);
                        console.log(order_sn);
                    });
                },
                moreAct: function moreAct(e) {
                    var that = this;
                    var itemListArray = [];
                    var goods_id = e.currentTarget.dataset.goods_id;
                    var goods_spec_id = e.currentTarget.dataset.goods_spec_id;
                },
                //选择卡券
                chooseCard: function chooseCard() {
                    var that = this;
                    app.component("card", {
                        success: function success(res) {
                            that.$router.go(-1);
                            that.card_code = res.card_code;
                            that.card_title = res.card_title;
                            that.loadCart(1);
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/goods", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    data: {},
                    popup: 0,
                    choose_property_data: {},
                    choose_property_data_copy: {},
                    choose_spec: {},
                    disabled: 1,
                    shopInfo: {},
                    shop_id: 0,
                    spec_keys_str: ""
                };
            },
            el: "#pageGoods",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                app.swiper("swiper-container-520275");
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.id = this.$route.params.id;
                    this.loadGoodInfo();
                },
                chooseSpec: function chooseSpec() {
                    // this.popup=1;
                    console.log(123);
                    app.show_popup($("#popup_goods"));
                },
                btn_cancel: function btn_cancel() {
                    // this.popup=0;
                    // this.setData({ popup:0});
                    app.hide_popup($("#popup_goods"));
                },
                //选规格
                chooseProperty: function chooseProperty(e) {
                    // console.log(e); 
                    var property = $(e.target).attr("data-property");
                    var subProperty = $(e.target).attr("data-sub-property");
                    this.choose_property_data_copy = {};
                    this.choose_property_data[property] = subProperty;
                    var arr = [];
                    for (var i in this.choose_property_data) {
                        arr.push(this.choose_property_data[i]);
                    }
                    // console.log(this.data.property_arr.length);
                    if (arr.length == this.data.property_arr.length) {
                        this.spec_keys_str = arr.join(" ");
                        // this.setData({ spec_keys_str: arr.join(" ") });
                        var l = arr.length;
                        for (var j = 0; j < 5 - l; j++) {
                            arr.push("");
                        }
                        // console.log(arr,arr);
                        var spec_keys = arr.sort();
                        var spec_keys_str = spec_keys.join("_");
                        if (this.data.goods_spec[spec_keys_str] && this.data.goods_spec[spec_keys_str].spec_stock > 0) {
                            this.choose_spec = this.data.goods_spec[spec_keys_str];
                            this.disabled = 0;
                        } else {
                            app.alert("已售空");
                            this.disabled = 1;
                        }
                    }
                    this.choose_property_data_copy = this.choose_property_data;
                },
                //加载购物车
                loadGoodInfo: function loadGoodInfo() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.data = {};
                    }
                    this.loading = 1;
                    app.get("mall/goods/find", {
                        id: this.id
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        that.data = res.data;
                        that.shop_id = res.data.shop_id;
                        that.getShopInfo();
                        app.setTitle(res.data.goods_name);
                        if (that.data.property_arr.length > 0) {
                            that.disabled = 1;
                        } else {
                            that.disabled = 0;
                        }
                    });
                },
                gotCart: function gotCart() {
                    this.$router.push({
                        name: "cart",
                        params: {
                            shop_id: this.shop_id
                        }
                    });
                },
                getShopInfo: function getShopInfo() {
                    var that = this;
                    app.get("/mall/shop/find", {
                        id: this.shop_id
                    }, function(res) {
                        if (res.code != 200) {
                            app.alert(res.msg);
                        } else {
                            that.shopInfo = res.data;
                        }
                    });
                },
                buyNow: function buyNow(e) {
                    // console.log(e);
                    var postData = {};
                    var type = $(e.target).attr("data-type");
                    if (this.data.property_arr.length > 0 && this.choose_spec.spec_stock > 0) {
                        postData.goods_id = this.choose_spec.goods_id;
                        postData.goods_spec_id = this.choose_spec.id;
                    } else if (this.data.property_arr.length === 0) {
                        postData.goods_id = this.data.id;
                    } else {
                        this.chooseSpec();
                        return;
                    }
                    //加入购车
                    this.loading = 1;
                    var that = this;
                    this.loading = 1;
                    this.disabled = 1;
                    app.get("mall/cart/add", postData, function(res) {
                        that.loading = 0;
                        that.loading = 0;
                        that.disabled = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        // console.log();
                        if (type == "buyNow") {
                            that.$router.push({
                                name: "checkout",
                                params: {
                                    shop_id: res.data.shop_id
                                }
                            });
                        } else {
                            that.btn_cancel();
                            app.confirm({
                                text: "成功加入购物车",
                                confirmText: "去结算",
                                cancelText: "返回",
                                yes: function yes() {
                                    that.$router.push({
                                        name: "checkout",
                                        params: {
                                            shop_id: res.data.shop_id
                                        }
                                    });
                                },
                                no: function no() {
                                    that.$router.go(-1);
                                }
                            });
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/index", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    pid: 0,
                    from: "wx",
                    showType: 1,
                    weui_icon: "",
                    weui_msg_title: "",
                    weui_msg_desc: ""
                };
            },
            el: "#pageIndex",
            created: function created() {
                this.fetchData();
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.from = this.$route.params.from;
                    var user_info = app.getUserInfo();
                    if (this.from == "app") {
                        this.showType = 3;
                        app.get("apiv2/mch/mch_info_search", {
                            store_id: 281
                        }, function(res) {
                            if (res.code == 200) {
                                _this.merchant = res.data;
                                _this.showType = 2;
                                if (_this.merchant.status < 1) {
                                    _this.weui_icon = "weui_icon_waiting weui_icon_msg";
                                    _this.weui_msg_title = "申请已提交，审核中...";
                                    _this.weui_msg_desc = "我们将在一个工作日完成审核。";
                                }
                                if (_this.merchant.status == 1) {
                                    _this.weui_icon = "weui_icon_success weui_icon_msg";
                                    _this.weui_msg_title = "通过审核";
                                    _this.weui_msg_desc = "资料已通审核，可正常使用收款功能。";
                                }
                                if (_this.merchant.status == 2) {
                                    _this.weui_icon = "weui_icon_warn weui_icon_msg";
                                    _this.weui_msg_title = "审核不通";
                                    _this.weui_msg_desc = "原因：" + _this.merchant.statusInfo.examineStatusRemark + "。";
                                }
                            } else {
                                _this.showType = 1;
                            }
                        });
                    }
                },
                reapply: function reapply() {
                    this.showType = 1;
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/main", [ "app" ], function(require) {
    var PuthinkApp = require("app");
    //vue 组件
    // require('js/component');
    //zach
    //配置文件
    var params = {
        apiDomain: seajs.data.apiDomain ? seajs.data.apiDomain : "https://www.bestsmartbee.com/",
        //接口域名 不带"/"
        domain: "",
        //网站域名  不带"/",
        appname: seajs.data.appname,
        debug: seajs.data.debug ? seajs.data.debug : false,
        versions: seajs.data.versions ? seajs.data.versions : "6.8",
        userVersions: seajs.data.userVersions ? seajs.data.userVersions : "6.9"
    };
    //app 实例之后 ， 只执行一次
    PuthinkApp.afterInit = function() {
        var _hmt = _hmt || [];
    };
    //页面显示时引用，每次都会执行
    PuthinkApp.pageShow = function(params) {
        var name = params.name;
    };
    //实例化app
    window.app = new PuthinkApp(params);
    app.login(function() {
        app.init();
    });
});

"use strict";

define("./js/router", [], function(require, exports, module) {
    var Router = new VueRouter({
        routes: [ {
            path: "/",
            name: "index",
            page: "cache",
            title: "商品分类"
        }, {
            path: "/tag/:tag_id",
            name: "tag",
            title: "商品列表"
        }, {
            path: "/goods/:id",
            name: "goods",
            title: "商品详情"
        }, {
            path: "/checkout/:shop_id",
            page: "cache",
            name: "checkout",
            title: "结算"
        }, {
            path: "/cart/:shop_id",
            name: "cart",
            title: "购物车"
        }, {
            path: "/cartAll",
            name: "cartAll",
            title: "我的购物车"
        }, {
            path: "/address/:type",
            name: "address",
            title: "地址管理"
        }, {
            path: "/category/:shop_id",
            name: "category",
            title: "分类"
        }, {
            path: "/shop_list/shop_id/:shop_id/tag_id/:tag_id",
            name: "shopList",
            title: "商家列表"
        } ]
    });
    module.exports = Router;
});

"use strict";

define("./js/shopList", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    shop_info: {},
                    loading: 0,
                    page: 1,
                    status: 0,
                    lastpage: 0,
                    listData: [],
                    tag_id: 0,
                    shop_id: 0,
                    nodata: 0,
                    order: "MallShopProvider.id desc"
                };
            },
            el: "#pageShopList",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                app.pager("#pageShopList", function() {
                    that.loadList();
                });
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.shop_id = this.$route.params.shop_id;
                    this.tag_id = this.$route.params.tag_id;
                    this.loadList();
                    this.loadTagInfo();
                },
                loadTagInfo: function loadTagInfo() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.data = {};
                    }
                    this.loading = 1;
                    app.get("mall/tag/find", {
                        id: this.tag_id
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        app.setTitle(res.data.name);
                    });
                },
                setOrder: function setOrder(e) {
                    var order = e.currentTarget.dataset.order;
                    if (this.order == order) {
                        return;
                    }
                    this.order = order;
                    // this.setData({ order: order });
                    this.loadList(1);
                },
                loadList: function loadList(reload) {
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.page = 1;
                        this.lastpage = 0;
                        this.listData = [];
                    }
                    var page = this.page;
                    if (this.loading == 1 || this.lastpage == 1) {
                        // console.log('12');
                        return;
                    }
                    this.loading = 1;
                    app.get("mall/shop_provider/get", {
                        page: page,
                        limit: 30,
                        provider_shop_id: this.shop_id,
                        tag_id: this.tag_id,
                        order: this.order
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        if (res.data.list.length === 0) {
                            that.lastpage = 1;
                        }
                        that.page++;
                        that.listData = that.listData.concat(res.data.list);
                        if (that.listData.length > 0) {
                            that.nodata = 0;
                        } else {
                            that.nodata = 1;
                        }
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

"use strict";

define("./js/tag", [ "router" ], function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function data() {
                return {
                    shop_info: {},
                    loading: 0,
                    page: 1,
                    status: 0,
                    lastpage: 0,
                    listData: [],
                    tag_id: 26,
                    order: "MallGoods.order_by desc"
                };
            },
            el: "#pageTag",
            created: function created() {
                this.fetchData();
            },
            mounted: function mounted() {
                if (this.mounted == 1) {
                    return;
                }
                var that = this;
                app.pager("#pageTag", function() {
                    that.loadList();
                });
                this.mounted = 1;
            },
            methods: {
                fetchData: function fetchData() {
                    var _this = this;
                    this.tag_id = this.$route.params.tag_id;
                    this.loadList();
                    this.loadTagInfo();
                },
                loadTagInfo: function loadTagInfo() {
                    var reload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.data = {};
                    }
                    this.loading = 1;
                    app.get("mall/tag/find", {
                        id: this.tag_id
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        app.setTitle(res.data.name);
                    });
                },
                setOrder: function setOrder(e) {
                    var order = e.currentTarget.dataset.order;
                    if (order == "price") {
                        order = this.order == "MallGoods.price" ? "MallGoods.price desc" : "MallGoods.price";
                    }
                    if (this.order == order) {
                        return;
                    }
                    this.order = order;
                    // this.setData({ order: order });
                    this.loadList(1);
                },
                loadList: function loadList(reload) {
                    var that = this;
                    if (reload == 1) {
                        this.loading = 0;
                        this.page = 1;
                        this.lastpage = 0;
                        this.listData = [];
                    }
                    var page = this.page;
                    if (this.loading == 1 || this.lastpage == 1) {
                        // console.log('12');
                        return;
                    }
                    this.loading = 1;
                    app.get("mall/goods/get", {
                        page: page,
                        limit: 30,
                        tag_id: this.tag_id,
                        order: this.order,
                        fields: "id,goods_name,total_stock,origin_price,price,sub_title,order_count,shop_id,default_img"
                    }, function(res) {
                        that.loading = 0;
                        if (res.code != 200) {
                            app.alert(res.msg);
                            return;
                        }
                        if (res.data.list.length === 0) {
                            that.lastpage = 1;
                        }
                        that.page++;
                        that.listData = that.listData.concat(res.data.list);
                    });
                }
            }
        }).$mount("#app");
    };
    module.exports = controller;
});

define("./template_js/address", [], function(require, exports, module) {
    return '<div class="page-content">  <section class="errormsgDiv"   v-if="nodata">    <p class="errormsg">（￣︶￣）/</p>    <p class="errormsg2">您还没有创建地址哦</p> </section><!-- 地址列表 --><div class="weui_cells weui_cells_checkbox"  v-else style="margin-top:0">         <label class="weui_cell weui_check_label" v-for="(item,index) in listData" >         <!--  <div class="weui_cell_hd"  @click="selectAddress(index)">                           <i class="weui_icon_checked"></i>          </div> -->          <div  class="weui_cell_bd weui_cell_primary"  @click="selectAddress(index)">              <p><b>{{item.userName}}，{{item.telNumber}}</b></p>              <p>{{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.detailInfo}}</p>          </div>          <div class="weui_cell_hd" @click="newAddress(index)">              <i class="icon iconfont icon-xiugai"></i>          </div>      </label>  </div>  <div class="goods-bottom-fix" >      <div class="btn btn2 w100" style="padding: 10px 12px;" @click=\'newAddress()\'>新增地址</div>    </div>  <!-- 地址新增 -->  <form  id="formNewAddress" :class="showNewAddress?\'weui_dialog_alert\':\'weui_dialog_alert hidden\'" >    <div class="weui_mask" style="    z-index: 2;" v-on:click="hideNewAddress()"></div>    <div class="weui_dialog" style="width:90%;z-index: 3">        <div class="weui_dialog_hd"><strong class="weui_dialog_title">编辑收货地址</strong></div>        <div class="weui_dialog_bd" style="padding:0">             <div class="weui_cells weui_cells_form">                <div class="weui_cell"  v-if="isWeiXin" @click="openAddress">                        <div class="weui_cell_hd"><label style="width: 100%; color: #98840b" class="weui_label">                          使用微信收货地址 [ 推荐 ]                      </label></div>                                             </div>                    <div class="weui_cell">                        <div class="weui_cell_hd"><label style="width: 76px;" class="weui_label">姓名</label></div>                        <div class="weui_cell_bd weui_cell_primary">                            <input class="weui_input" type="text" name="userName" :value="editData.userName" placeholder="请输入姓名">                            <input type="hidden" name="id" :value="editData.id">                        </div>                    </div>                    <div class="weui_cell">                        <div class="weui_cell_hd"><label style="width: 76px;"   class="weui_label">电话</label></div>                        <div class="weui_cell_bd weui_cell_primary">                            <input class="weui_input" type="number" name="telNumber" :value="editData.telNumber"  placeholder="请输入电话">                        </div>                                             </div>                    <div class="weui_cell"  >                        <div class="weui_cell_hd"><label style="width: 76px;"  class="weui_label">地区</label></div>                        <label  for="areaAddress" class="weui_cell_bd weui_cell_primary">                            <input id="areaAddress" :value="editData.provinceName && (editData.provinceName + editData.cityName + editData.countryName)"  class="weui_input" type="text" placeholder="请输入地区">                        </label>                    </div>                    <div class="weui_cell">                        <div class="weui_cell_hd"><label  style="width: 76px;"  class="weui_label">详细地址</label></div>                        <div class="weui_cell_bd weui_cell_primary">                            <input class="weui_input" type="text" name="detailInfo" :value="editData.detailInfo" placeholder="请输入详细地址">                        </div>                                            </div>                </div>            <div style="padding: 20px 10px;">            <div class="btn btn2 w100" @click=\'saveAddress()\'>保存并使用</div>               <div class="btn btn3 w100 mgt10" @click=\'delAddress()\'>删除收货地址</div>            </div>         </div>         <div class="weui_dialog_ft">            <a href="javascript:;"  v-on:click="hideNewAddress()" class="weui_btn_dialog primary">关闭</a>        </div>            </div></form>  <!-- 地址新增 --></div>';
});

define("./template_js/cart", [], function(require, exports, module) {
    return '<div class="page-content page-content-cart">   <div class=\'shopping-cart\'>  <div class="title">      <a :href="\'/apps/takeout?store_id=\'+shop_info.store_id+\'#/\'+shop_info.shop_id" class="s_left buy-title">{{shop_info.name}}  <img style="    height: 10px;"  class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\' ></a>      <span class="dishes s_right" @click=\'clearCart\'>清空购物车</span>    </div>         <div class="errormsgDiv" v-if="empty==1">                            <div class="errormsg">（￣︶￣）/</div>                            <div class="errormsg2">当前购物车空荡荡的</div>                            <div class="errormsg2">你快去犒劳一下自己吧</div>       </div>             <div  class="order-list" wx:else>          <div class="ul" style="height: auto; overflow: visible;">                   <!-- goods-item -->          <div v-for="(item,idx) in shoppingCartList.list" class="goods-item" >             <a class="goods-item-img" :href="\'/apps/shop/?store_id=\'+app.getStoreId()+\'#/goods/\'+item.goods_id" style="display: block;"> <img  :src="item.default_img+\'?imageView2/1/w/140/h/160\'" /></a>             <div class="goods-item-info">          		           <a :href="\'/apps/shop/?store_id=\'+app.getStoreId()+\'#/goods/\'+item.goods_id" style="display: block;">  {{item.goods_name}}</a>  		            <div v-if="item.attrs" class="na-attr">{{item.attrs}}</div>    		          <div class="s_left modify">   		            <i class="icon iconfont icon-jianshao s_left" :data-id="idx" :data-goods_spec_id="item.goods_spec_id" :data-goods_id="item.goods_id"  @click=\'minus\'></i>		            <input style="margin-top: 2px;" type="number" catchtap="edit" @blur="changeCount" :data-goods_spec_id="item.goods_spec_id" :data-goods_id="item.goods_id" class="s_left txt-count" :data-id="idx" :value="item.count" maxlength="2" />  		            <i class="icon iconfont icon-zengjia s_left" style="margin-top: 1px;" :data-id="idx" :data-goods_spec_id="item.goods_spec_id" :data-goods_id="item.goods_id"  @click=\'plus\'></i>		        </div>		          <div class="s_right pri ">    <span>¥{{item.price}}</span>  </div> 		          <div class=\'clear\'></div>		           			</div>           </div>		 <!-- goods-item -->                      </div>          <div class="other-charge">           <!-- 优惠 -->            <div v-for="charge in shoppingCartList.other_charge"  class="clearfix packing-cost">              <span class="s_left">{{charge.name}}</span>              <span class="s_right boxtotalprice">{{charge.showPrice}}</span>            </div>            <!-- 优惠 -->          </div>        </div>     </div>          <div style="height: 50px"></div><div class="goods-bottom background_color_3 color_3">              <div class="icon iconfont icon-03 cart" bindtap="show_popup">        <i class="icon iconfont icon-qicheqianlian-1-copy"></i>        <span class="background_color_1 color_1 cartAll"  v-if="shoppingCartList.count>0">{{shoppingCartList.count}}</span> </div>          <div class="goods-bottom-left"> <div v-if="shoppingCartList.total_price>0"> 合计：¥ <span id="priceAll">{{shoppingCartList.total_price}}</span> </div> </div>   <!-- <div class="goods-bottom-right btn2" bindtap="settle_accounts">去结算</div> -->    <div :class="shoppingCartList.next ? \'goods-bottom-right btn2\': \'goods-bottom-right btn2 disabled\'" @click="settle_accounts">{{shoppingCartList.nextText?shoppingCartList.nextText:\'loading...\'}}</div></div>        </div>';
});

define("./template_js/cartAll", [], function(require, exports, module) {
    return '<div class="page-content cartAll"><section class="errormsgDiv"   v-if="empty">    <p class="errormsg">（￣︶￣）/</p>    <p class="errormsg2">购物车是空的</p> </section> <section v-else>  <div class="cart-goods" style="border:none"  v-for="data in listData" > 	   <div class="cart-title">        <a :href="\'/apps/takeout?store_id=\'+data.shop_info.store_id+\'#/\'+data.shop_info.shop_id" class="s_left" style="max-width: 70%;">{{data.shop_info.name}} <img style="    height: 10px;"  class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\' ></a>        <span class="s_right color_0" @click=\'clearCart(data.shop_id)\'>删除</span>        <div class="clear"></div>        </div>        <router-link :to="{ name: \'cart\', params: { shop_id: data.shop_info.shop_id }}"   class="goods-item-list goods-item-list-more">          <div class="goods-item" v-for="item in data.list" >                  <image class=\'image\' :src=\'item.default_img+"?imageView2/1/w/160/h/160"\'></image>                  <div class=\'goods-info\'>                    <div class="title1 span-over-hidden" >{{item.goods_name}}</div>                    <div class="light">{{item.attrs}} × {{item.count}} </div>                  </div>                                  <div class="clear"></div>          </div>           <div class="clear"></div>        </router-link>        <div class="cart-bottom ">共 <span class="color_0"> {{data.count}} </span>件商品  总金额  ¥<span class="color_0"> {{data.order_amount}}</span></div>                         </div>      </section></div>';
});

define("./template_js/category", [], function(require, exports, module) {
    return '<div class="page-content">    <!--pages/order/index.wxml-->  <section class="ul">    <div class="category-item mg10" v-for="item in listData">      <div class="title">{{item.category_name}}</div>       <router-link  v-for="(tag,idx) in item.tags"   :to="{ name: \'shopList\', params: { shop_id: shop_id , tag_id: tag.id}}"  :class="(idx+1)%5 == 0 ? \'li border-right-none\' : \'li\' " >           <div><img :src=\'tag.pic+"?imageView2/1/w/200/h/200"\' /></div>            <div class="overHidden">{{tag.name}}</div>       </router-link>      <div class="clear"></div>    </div> </section></div>';
});

define("./template_js/checkout", [], function(require, exports, module) {
    return '<div class="page-content">      <form bindsubmit="formSubmit">  <div class="address" v-if="data.type===0">   <div class="address-box"><!-- 收货地址 -->      <label    for="bindChangeCeliveryC" class="address-left picker"  >      <div class="address-left-text">{{delivery_type}}</div>      <image class=\'ico\' src=\'/apps/shop/images/113.png\'></image>       <input type="text" style="display:  none;" value="" id="bindChangeCeliveryC">     </label>     <div class="address-right">       <div class="address-item">           <router-link :to="{ name: \'address\', params: { type: 1 }}" v-if="address.telNumber">                <image class=\'ico\' src=\'/apps/shop/images/112.png\'></image>                <div v-if="delivery_type==\'送货上门\'">                  <div class="title1">                  {{address.provinceName}}{{address.cityName}}{{address.countyName}}{{address.detailInfo}} </div>                  <div class="info"> {{address.userName}}   {{address.telNumber}}</div>                </div>                <div v-if="delivery_type==\'到店自取\'">                  <div class="title1">{{address.userName}}   {{address.telNumber}}</div>                                </div>           </router-link>             <router-link :to="{ name: \'address\', params: { type: 1 }}" v-else>               <image class=\'ico\' src=\'/apps/shop/images/112.png\'></image>               <div class="title1" v-if="delivery_type==\'送货上门\'">请选择收货地址</div>                <div class="title1" v-if="delivery_type==\'到店自取\'">请选择联系方式</div>                <div class="info">点击这里</div>            </router-link>             <image class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\'></image>      </div>              <!-- 收货地址 -->      <!-- 选择配送时间 -->     <label  class="picker" for="chooseDeliveryType">          <div class="address-item" style="border-bottom:none;" v-if="delivery_type==\'送货上门\'">          <image class=\'ico\' src=\'/apps/shop/images/111.png\'></image>          <div class="title1">{{delivery_time[0]}}           <span class="light" v-if="data.freight && data.freight.EstimatedTimeOfArrival>0">{{delivery_time[1]}}{{delivery_time[2]?"~"+delivery_time[2]:\'\'}}送达</span>          </div>            <image class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\'></image>         </div>               <div class="address-item" style="border-bottom:none;" v-if="delivery_type==\'到店自取\'">          <image class=\'ico\' src=\'/apps/shop/images/111.png\'></image>          <div class="title1">{{delivery_time[0]==\'尽快送达\'?\'今天\':delivery_time[0]}}          <span v-if="data.freight.EstimatedTimeOfArrival>0" class="light">{{delivery_time[1]}}{{delivery_time[2]?"~"+delivery_time[2]:\'\'}}到店</span>          </div>            <image class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\'></image>         </div>         <input type="text" value="" style="display:  none;" id="chooseDeliveryType">     </label><!-- 选择配送方式 -->     </div>     <div class="clear"></div>  </div></div><div v-if="delivery_type==\'送货上门\' && delivery_coverage>0"  class=\'charge-item bgw pd10 chooseCard\'> <div class="charge-item-left">配送范围</div> <div class="charge-item-right" style=\'width:75%;text-align:right;\'>  <span >{{delivery_coverage}} 公里内</span> </div>  <div class="clear"></div></div>   <!-- 坐标 --><!-- <div v-if="isWeiXin && delivery_type==\'送货上门\' && delivery_coverage>0"  class=\'charge-item bgw pd10 chooseCard\' @click=\'chooseLocation\'> <div class="charge-item-left">地理位置</div> <div class="charge-item-right" style=\'width:75%;text-align:right;\'> <span class=\'light\' v-if="location_info==\'\'">请选择坐标，以便我们更准确送达</span> <span v-else>{{location_info.address}} {{location_info.latitude}},{{location_info.longitude}} </span> </div>  <img class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\'/>  <div class="clear"></div></div> --><!-- 坐标 --><!-- 商品列表 --><div class="cart-goods" ><div class="cart-title" @click=\'openlocation\'><div class="s_left"> <image class=\'ico\' src=\'/apps/shop/images/112.png\'></image> {{data.shop_info.name}}</div><div class="s_right" v-if="data.business_hours">营业时间：{{data.business_hours}}</div><div class="clear"></div></div><div v-for="item in data.list" class="goods-item" @click=\'moreAct\' data-goods_spec_id="item.goods_spec_id" data-goods_id="item.goods_id">        <image class=\'image\' :src=\'item.default_img+"?imageviwe2/1/w/160/h/160"\'></image>        <div class=\'goods-info\' style="margin-top: 0">          <div class="title1" >{{item.goods_name}}</div>          <div class="light">{{item.attrs}}</div>         </div>         <div class=\'goods-count\'>x{{item.count}}</div>         <div class="goods-price">¥{{item.total_price}}</div>         <div class="clear"></div> </div>  <div class=\'charge-item\'  v-for="charge in data.other_charge"> <div class="charge-item-left">{{charge.name}}</div> <div class="charge-item-right">{{charge.showPrice}}</div>  <div class="clear"></div></div><div class=\'remark\'>   <div class="remark-text">备注</div>   <input name="remark" placeholder="备注..." />     <div class=\'clear\'></div></div><div class=\'line\'></div><div class=\'goods-total-price\'>   共计{{data.count}}件商品 ， 小计{{data.total_price}}元</div></div><div   class=\'charge-item bgw pd10 chooseCard\' @click="chooseCard" > <div class="charge-item-left">优惠券码</div> <div class="charge-item-right">{{card_title?"选择："+card_title:\'选择优惠\'}}</div>  <image class=\'arrowright\' src=\'/apps/shop/images/arrowright.png\'></image>  <div class="clear"></div></div><div style=\'height:100px\'></div><div class="goods-bottom" >    <div class="goods-bottom-left" style="    margin-top: 14px;margin-left: 10px; text-align: left;"> ¥{{data.total_price}}      <span class="light" v-if="data.discounts>0">| 已优惠{{data.discounts}}元</span>     </div>    <div    :class="disabled?\'goods-bottom-right btn disabled\':\'goods-bottom-right btn\'" @click=\'formSubmit\' >马上下单</div></div></form></div>';
});

define("./template_js/goods", [], function(require, exports, module) {
    return '<div class="page-content"> <!--pages/goods/index.wxml--> <div class="swiper-container" id="swiper-container-520275" >    <div class="swiper-wrapper">       <div class="swiper-slide" v-for="item in data.imglist">         <img   :src="item.file_url+\'?imageMogr2/thumbnail/800x\'">       </div>    </div>  </div><div class=\'goods-info\'><div class="title mgt10">{{data.goods_name}}</div><div v-if="data.sub_title" class="light mgt10">{{data.sub_title}}</div><div class="goods-price mgt10">¥<span class=\'price\'>{{choose_spec.spec_price?choose_spec.spec_price:data.price}}</span></div></div><div class=\'goods-spec\' @click=\'chooseSpec\' v-if="data.property_arr && data.property_arr[0]">选择：  <span v-if="spec_keys_str" >{{spec_keys_str}}</span>  <span v-else  v-for="item in data.property_arr">{{item.name}} </span></div><div class=\'goods-content pd10\' v-if="data.content"  v-html="data.content"></div><div style=\'height:80px\'></div><div class="goods-bottom"  style="z-index:9999">    <div class="goods-bottom-left">         <a :href="\'tel://\'+shopInfo.hotline" class="s_left" style="margin-left: 20px; display: block;">         <div><i style="color: #f44;" class="icon iconfont icon-customerservice" ></i></div>         <div>客服</div>     </a>      <div @click="gotCart" class="s_left" style="margin-left: 20px;">        <div><i class="icon iconfont icon-qicheqianlian-1-copy"></i></div>        <div>购物车</div>      </div>    </div>        <div :loading="loading" :class="disabled==1?\'goods-bottom-right btn disabled\':\'goods-bottom-right btn\'" @click=\'buyNow\' data-type="addtocart" >加入购物车</div>   <div :loading="loading"     :class="disabled==1?\'goods-bottom-right btn2 disabled\':\'goods-bottom-right btn2\'" @click=\'buyNow\' data-type="buyNow">立即购买</div></div> <!--选规格弹出层-->   <div class="popup" id="popup_goods">   <div class="goodsItemBox">      <image :src=\'data.default_img+"?imageMogr2/thumbnail/200x"\'></image>       <div class=\'goods-info\'>        <div class="title">{{data.goods_name}}</div>        <div class="goods-price mgt5">¥<span class=\'price\'>{{choose_spec.spec_price?choose_spec.spec_price:data.price}}</span></div>        </div>        <div class="clear"></div>        <div class="line" style="  margin-top: 10px;"></div>   </div>       <div class="spec-box" v-if="data.property_arr" v-for="property in data.property_arr">     <div class=\'spec-name\'>{{property.name}}：</div>      <div class="spec-sub-list mgt10">         <div v-for="sub_property in property.sub"  :class=\'choose_property_data_copy[property.name]==sub_property.text?"spec-sub-name on":"spec-sub-name"\' :data-property="property.name" :data-sub-property="sub_property.text"  v-on:click="chooseProperty($event)">{{sub_property.text}}</div>     <div class=\'clear\'></div>     </div>    </div>    </div>  <!--弹出层--></div>';
});

define("./template_js/index", [], function(require, exports, module) {
    return '<div class="page-content"></div>';
});

define("./template_js/shopList", [], function(require, exports, module) {
    return '<div class="page-content">    <!--pages/order/index.wxml--><div class="tab"> <div data-order="MallShopProvider.id desc" @click=\'setOrder\' :class="order==\'MallShopProvider.id desc\'?\'tabli on\':\'tabli\'"><span>默认</span></div> <div data-order="MallShop.rate desc"  @click=\'setOrder\'  :class="order==\'MallShop.rate desc\'?\'tabli on\':\'tabli\'"><span>评分</span></div> <div data-order="MallShop.order_count desc" @click=\'setOrder\'  :class="order==\'MallShop.order_count desc\'?\'tabli on\':\'tabli\'"><span>销量</span></div> </div> <section class="errormsgDiv"   v-if="nodata">    <p class="errormsg">（￣︶￣）/</p>    <p class="errormsg2">当前未查到相关商家</p> </section> <section class="shoplist___2CNKr mgt10" v-else> <a  v-for="item in listData" class="shopitem___WG1Zl" :href="item.shopHomeUrl">   <div class="shopinfo___3BehK">    <div class="logo___1xVXC">     <img src="{/item.logo/}" alt="logo" />    </div>    <div class="main___7ws2g">     <div class="line___k_t94">      <h3 class="name___1oTLY">{{item.name}}</h3>     </div>     <div class="line___k_t94">      <div class="rate____3zGBw">             <!--  <i class="iconfont icon-xingxingselecetd active___10Y1U" ></i> -->       <span>评分：{{item.rate}}</span>       <span> 销量：{{item.orderCount}}单</span>      </div>     </div>     <div class="line___k_t94">{{item.address}}</div>    </div>    <div class="distance___1oP3g">     <p>{{item.cityName}}</p>     <p>{{item.districtName}}</p>    </div>    <div class="clear"></div>   </div> </a>  </section><!-- 周边商家 -->     </div>';
});

define("./template_js/tag", [], function(require, exports, module) {
    return "<div class=\"page-content\">    <!--pages/order/index.wxml--><div class=\"tab\"> <div data-order=\"MallGoods.order_by desc\" @click='setOrder' :class=\"order=='MallGoods.order_by desc'?'tabli on':'tabli'\"><span>默认</span></div> <div data-order=\"price\"  @click='setOrder'  :class=\"(order=='MallGoods.price'||order=='MallGoods.price desc')?'tabli on':'tabli'\"><span>价格</span></div> <div data-order=\"MallGoods.order_count desc\" @click='setOrder'  :class=\"order=='MallGoods.order_count desc'?'tabli on':'tabli'\"><span>销量</span></div> <div data-order=\"MallGoods.id desc\" @click='setOrder'  :class=\"order=='MallGoods.id desc'?'tabli on':'tabli'\"><span>最新上架</span></div></div>  <div class=\"goodslist\" v-for=\"data in listData\"> <div class=\"goodsitem\">  <router-link :to=\"{ name: 'goods', params: { id: data.id }}\" >    <img mode=\"widthFix\" :src='data.default_img+\"?imageView2/1/w/360/h/360\"'/>    <div class='goods_name'>{{data.goods_name}}</div>     <div class='price'>      <span class=\"s_left\">{{data.price}}</span>      <img src='/apps/shop/images/addtocart.png' class='ico s_right'/>      <div class='clear'></div>     </div>  </router-link> </div></div>       </div>";
});
